Tree module refactoring
The last few days have been mildly productive in regards of coding amount and quality. The module I have been working on is pydsl.Grammar.Tree. The code is now shorter and also more concise; AST is not a class anymore. The previous class hierarchy was:
- Tree
- AST
- ParseTree
- RecursiveDescentResultTree
There was almost no common code in Tree, and most of the AST and ParseTreeĀ functions were duplicated.
The new class hierarchy is:
- Tree
- PositionTree
- ParseTree
- RecursiveDescentResultTree
becomes the new base class and includes all the basic tree functions. A few functions have been renamed to improve clarity (getAllByOrder -> to_list)
PositionTree covers all the trees whose nodes store its position. And ParseTree have a few extra functions only used during tree generation. In summary, these changes helps in the Syntax Directed Translator implementation and the ANTLR grammar definition reading, because both of them require a proper AST tree implementation
What did you say? |
Another discovery I made during the refactoring. An unknown part of the Voynich manuscript that appeared in one of the pydsl files. Special prize for the person that discovers its meaning.