A simple scripting language tree walk interpreter written in C++. This is version 1 of the interpreter.
- Numbers: Numeric literals (integers and floating-point)
- Numeric Literals:
42,3.14 - Identifiers: Variable and function names
- Binary Expressions:
- Arithmetic:
+,-,*,/,% - Comparison:
>,<,>=,<= - Equality:
===,!== - Logical:
&&,||
- Arithmetic:
- Assignment Expressions:
=,+=,-=,*=,/= - Call Expressions: Function calls with arguments
fn(arg1, arg2) - Grouped Expressions: Parenthesized expressions
(expression)
- Variable Declaration:
let x = 10 - Expression Statement: Any expression used as a statement
- If/Else Statement: Conditional branching with
if,else, andelse ifchains - While Loop:
while(condition) { ... } - Block Statement: Code blocks
{ ... }with proper lexical scoping - Return Statement:
returnorreturn expression - Function Declaration:
function name(param1, param2) { ... }
- Named function declarations (anonymous functions not supported)
- Function parameters and arguments
- Function calls with multiple arguments
- Recursion: Fully supported
- Higher-order functions: Functions can be passed as arguments and returned from functions
- Return values from functions (including function objects)
print(...): Output to console (accepts variable number of arguments)type(value): Returns the type of a value
- Lexical scoping with environment-based variable resolution
- Proper operator precedence
- First-class functions (can be stored in variables and passed as arguments)
cmake -S . -B build
cmake --build build./build/scriptum path/to/script.txtExample:
./build/scriptum testFiles/test1.txt- Anonymous functions / function expressions
- String and boolean literal types
- Array and object data structures
- For loops
- Additional operators (unary operators, ternary, etc.)
- Bytecode compiler
- Stack-based virtual machine
- Garbage collector
- JIT