Skip to content
xmasdevPublic

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Melonlang

a toy programming langauge with basic arithmetic, logic, and goto statements

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

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages