You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document the limitations of ANTLR (see the open kotlin tasks)
Output of ANTLR is a parse tree, and not a syntax tree. Therefore the tree is overly detailed. Ideally one would convert the parse tree into a custom AST, with custom nodes, which can be extends with custom attributes (e.g. for XPath attributes), etc.
Antlr nodes cannot be extended (e.g. adding additional getters/attributes to expose some information for XPath). The issue is, that they're all generated into the same file...
Of note, that the generated tree is not an abstract syntax tree in any way, it's a parse tree. There's a node for every token, or every error, which makes gigantic trees. Antlr recommends building a separate AST if we want one, but then we would have to define all the nodes and visitor interface ourselves... This is a fundamental problem with using antlr, possibly it should be mentioned somewhere in the doc.
Key users of the doc: language implementers, that want to add a new language to PMD based
on a antlr grammar.
Other users of the doc: rule writers, that want to write a new rule for a language
implemented using antlr (here comes the difference between AnltrBaseRule and AbstractRule...)
Part of #2499
Document the limitations of ANTLR (see the open kotlin tasks)
Update/verify existing doc "adding_a_new_antlr_based_language.md"
on a antlr grammar.
implemented using antlr (here comes the difference between AnltrBaseRule and AbstractRule...)