> For the complete documentation index, see [llms.txt](https://todepond.gitbook.io/copy-of-mothertode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://todepond.gitbook.io/copy-of-mothertode/master.md).

# Introduction

![](https://1618078674-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MG5bMcJymc-Z9zChUqK%2F-MVmCdzmgi82XheEx-XD%2F-MVmExk89ZbDSZFAH-3p%2FMotherTode%400.5x.png?alt=media\&token=2f1bb875-dd2a-4a4d-92d9-cb9c4a8829c2)

MotherTode is a language that lets you make languages. It's a language language.

Its source code is here: [github.com/l2wilson94/MotherTode](https://github.com/l2wilson94/MotherTode)

**Warning: MotherTode is currently a work-in-progress and has some bugs and missing features. Check out the current issues** [**here**](https://github.com/l2wilson94/motherTode/issues)**.**

## How does it work?

Define your language by defining terms, like these:

```
Expression :: Number | String
```

```
Greeting :: "greet" >> "Hello world!"
```

## What does it look like?

This is a mini language that lets you add numbers (don't worry if you don't understand it yet):

```
:: Number {"\n" Number}
Number :: Add | Literal
Literal :: /[0-9]/+
Add (
    :: Number~Add "+" Number
    >> ([left, operator, right]) => parseInt(left) + parseInt(right)
)
```

## How do I use it?

You can embed it or import it:

```markup
<script src="mothertode-embed.js"></script>
```

```javascript
import MotherTode from "./mothertode-import.js"
```

Then use the `MotherTode` function:

```javascript
const language = MotherTode(`:: /[a-zA-Z]/+ >> (name) => "Hello " + name + "!"`)
const result = language("world")
console.log(result.output)
```
