- Variable Bindings:
let x = 42; let y = x + 8; - First-Class Functions:
let multiply = fn(a, b) { a * b; }; multiply(6, 7); // 42 - Closures:
let makeIncrementer = fn(x) { fn(y) { x + y; }}; let addTwo = makeIncrementer(2); addTwo(3); // 5 - Data Structures:
- Arrays:
[1, 2, 3] - Hash Maps:
{ "key": "value" }
- Arrays:
- Conditional Expressions:
if (5 > 3) { "Yes" } else { "No" }
-
Clone the repository:
git clone https://github.com/miggoxyz/miggolang.git cd miggolang -
Build the interpreter:
go build -o miggolang
-
Launch the REPL (Read-Eval-Print Loop):
./miggolang
-
Start writing Miggolang code:
>> let x = 10 * 2; >> x 20
- Lexer: Converts raw source code into tokens for processing.
- Parser: Constructs an Abstract Syntax Tree (AST) from tokens.
- Evaluator: Interprets the AST and executes operations dynamically.
- Built-in Functions: Includes functions like
len,first,last, and custom user-defined functions. - Error Handling: Gracefully identifies and reports syntax or runtime errors.