Skip to content

Refactor: Reorganize code parser following the ANTLR approach

Alexander Chueshev requested to merge refactor_code_parser into main

This MR reorganizes the existing code parser logic using the visitor pattern used by ANTLR - another code parser similar to tree-sitter.

The existing logic has several significant disadvantages:

  • many Optionals that can lead to runtime errors
  • huge maps of symbols per language and a lot of dict operations with string keys
  • hard to add new changes due to having all language-specific parsers in one class

With the new logic, we can implement and register a customer Visitor that collects and preprocess the required node information per language.

This MR doesn't update the existing ModelEnginePalm. We can update the engine with the next MR if this change looks good.

Merge request reports