MotherTode

MotherTode is a language that lets you make languages. It's a language language.
For more info, check out the documentation.

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 reads number and string literals (don't worry if you don't understand it yet):

:: Expression {"\n" Expression}
Expression :: Number | String
Number :: /[0-9]/+
String (
    :: '"' /[^"]/* '"'
    >> ([left, inner, right]) => "`" + inner + "`"
)

How do I use it?

You can embed it or import it.

<script src="mothertode-embed.js"></script>
import MotherTode from "./mothertode-import.js"

Then use the MotherTode function.

const language = MotherTode(`:: /[a-zA-Z]/+ >> (name) => 'Hello #{name}!'`)
language("world")