The java parser library currently being used returns a concrete syntax tree (CST). The process of converting it into an abstract syntax tree (AST) takes much effort and is complicated by the fact that it does not following Java Language Specification (JLS) faithfully. For example, the precedence of * over + in the expression 1 + 2 * 3 is not reflected in the CST output.
In an attempt to get rid of above hassles, this PR uses a parser generator pegjs to generate a Java parser that can return a custom AST. The references used are as follows:
Background
The java parser library currently being used returns a concrete syntax tree (CST). The process of converting it into an abstract syntax tree (AST) takes much effort and is complicated by the fact that it does not following Java Language Specification (JLS) faithfully. For example, the precedence of
*
over+
in the expression1 + 2 * 3
is not reflected in the CST output.In an attempt to get rid of above hassles, this PR uses a parser generator pegjs to generate a Java parser that can return a custom AST. The references used are as follows:
Work Done