Simple interpreter
Go to file
2024-08-28 19:31:35 -05:00
ast Update name change. 2024-08-28 19:31:35 -05:00
doc Update name change. 2024-08-28 19:31:35 -05:00
evaluator Update name change. 2024-08-28 19:31:35 -05:00
lexer Update name change. 2024-08-28 19:31:35 -05:00
object Update name change. 2024-08-28 19:31:35 -05:00
parser Update name change. 2024-08-28 19:31:35 -05:00
repl Update name change. 2024-08-28 19:31:35 -05:00
token Now supports strings. 2023-05-09 19:59:18 +00:00
go.mod Update name change. 2024-08-28 19:31:35 -05:00
main.go Update name change. 2024-08-28 19:31:35 -05:00
README.md Update name change. 2024-08-28 19:31:35 -05:00
readme.txt add readme 2022-06-01 14:27:07 +00:00

Monna Programming Language

This project is a result of learning the innards of compilers. Among other compiler books that I learned from, this was the most influential, especially in making this project: Writing an Interpreter In Go.

Demo of Monna working

Using

To use the Monna interpreter, simply run go run main.go in the project directory.To get an executable, run go build in the project directory.

Features

Variables:

let x = 5;

Return Statements:

return 5; 
return false;

Expressions:

if (x < y) { x }

if (x > y) { y } else { x }

Functions:

fn(x, y) { x + y; }

String Literals:

"Hello World"

Built-in Functions:

  • len(): Returns the number of characters in a string.
len("Dexter's Laboratory");
19
  • puts(): Prints the given arguments to STDOUT. It return a null. It only cares about printing not returning a value.
puts("Sugar, spice, and everything nice!");
Sugar, spice, and everything nice!

Error Handling:

The Monna programming language also responds accordingly to errors: Error Handling