Ark2000 / PankuConsole

Feature-packed real-time debugging toolkit for Godot Engine.
https://k2kra.xyz/PankuConsole/
MIT License
997 stars 38 forks source link

implement expression parser to extend abilities. #168

Open Ark2000 opened 5 months ago

Ark2000 commented 5 months ago

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.