Skip to content

TodePond/MotherTodeLegacy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a backup of MotherTode before I started rewriting it on the 17th August 2022

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 lets you add numbers (don't worry if you don't understand it yet):

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

This example takes an input of multiple numbers seperated by + symbols, and return what they add up to.

How do I use it?

You can embed it or import it, using the files located in /build/.

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

Then use the MotherTode function like so.

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

About

the old mothertode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published