A parser implemented using top-down operator precedence parsing.
- The input is sent to the lexer for lexical analysis
- The returned tokens are then passed to the parser. The parser creates an AST tree that can be evaluated.
# cargo run program.rmp
// Asign result to variable a
let main_expr = (2-3)*4+3^5+4+(-3+4^4)+5+6+2-1;
let sin_result = sin(10/5+(main_expr+2));
let cos_result = cos(30);
let value = to_number(readln("Insert value: "));
// Print variable a
println("Result main: ", main_expr);
// Concatenation using + symbol
println("Result sin(x): " + sin_result);
println(str_concat("This ", "is ", "an ", "example"));
- Write tests
- Implement mechanism on the interpreter to check for mandatory function arguments
- Exponential binary operations should be right-hand associative
- Check for undefined variables
- Add line number to errors
- Improve syntax errors
- Use peekabe iterable https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html