Refactor: Reorganize code parser following the ANTLR approach
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
Optional
s 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.