Implemented in golang like a classic interpreter, with lexer, parser building ASTs, and an evaluator maintaing the environment and executing statements line by line.
A basic overview of the language
# Program starts at the main label
main: {
# this is a comment
# gotos
goto some_label;
# declaration of variables
x = 10;
y = "Hello World";
z = 10.01;
# echo keyword for writing to stdout
echo "The value of x is $$x$$"
}
# label declaration
loop: {
# conditionals
if (x > 10){
x = x-1;
}
goto loop;
}
A simple example of a while loop is provided in the example.mel file
Running a sample .mel file
# clone the repo
git clone github.com/xmasdev/melonlang && cd melonlang
# compile
go build -o mel
chmod +x mel
# run a .mel file
./mel example.mel