PankuConsole icon indicating copy to clipboard operation
PankuConsole copied to clipboard

implement expression parser to extend abilities.

Open Ark2000 opened this issue 3 months ago • 0 comments

Approach:

implement a customed parser according to Expression source:

  1. https://github.com/godotengine/godot/blob/master/core/math/expression.cpp.
  2. https://github.com/godotengine/godot/blob/master/tests/core/math/test_expression.h

Basic Steps:

  1. Implement a lexical analyzer to tokenize the input expression string into individual tokens, such as numbers, operators, variable names, etc.
  2. Implement a parser to parse the token sequence into an abstract syntax tree (AST).
  3. Write an interpreter to traverse the AST and evaluate the expression.
  4. Provide support for variable references, function calls, etc.
  5. Implement necessary data structures, such as an operator precedence table, etc.
  6. Consider handling common edge cases and error situations.

Expected benefits:

  1. dynamic intelligent code completion support, instead of simple string matching.
  2. extended assignment expression support, instead of set method. #167

A customed parser will make panku console truely unique, powerful and irreplaceable.

Ark2000 avatar Mar 31 '24 01:03 Ark2000