PankuConsole
PankuConsole copied to clipboard
implement expression parser to extend abilities.
Approach:
implement a customed parser according to Expression
source:
- https://github.com/godotengine/godot/blob/master/core/math/expression.cpp.
- https://github.com/godotengine/godot/blob/master/tests/core/math/test_expression.h
Basic Steps:
- Implement a lexical analyzer to tokenize the input expression string into individual tokens, such as numbers, operators, variable names, etc.
- Implement a parser to parse the token sequence into an abstract syntax tree (AST).
- Write an interpreter to traverse the AST and evaluate the expression.
- Provide support for variable references, function calls, etc.
- Implement necessary data structures, such as an operator precedence table, etc.
- Consider handling common edge cases and error situations.
Expected benefits:
- dynamic intelligent code completion support, instead of simple string matching.
- extended assignment expression support, instead of set method. #167
A customed parser will make panku console truely unique, powerful and irreplaceable.