I am somewhat new to the Actipro Syntax Editor. I was exploring the “Getting Started” examples and noticed that the AST in the "4a - LL(*)" example had an unexpected ordering of the tree nodes for the arithmetic expressions.
Specifically, in the GettingStarted04a example, the AST displayed in the “Document Outline” box does not reflect expected arithmetic operator precedence nor left association. For example, the following code
function Add(a, b, c) {
return a - b + c;
}
results in the following AST (simplified):which orders the computation as if written as “a – (b + c)”.
The AST with expected order of computation would beMy questions are
1. Is there a way to modify the grammar so the expected operator precedence is reflected in the AST?
2. Or is there a way to use the tree construction class to modify the AST?
Any help here would be appreciated.
Specifically, in the GettingStarted04a example, the AST displayed in the “Document Outline” box does not reflect expected arithmetic operator precedence nor left association. For example, the following code
function Add(a, b, c) {
return a - b + c;
}
results in the following AST (simplified):
-
/ \
a +
/ \
b c
The AST with expected order of computation would be
+
/ \
- c
/ \
a b
1. Is there a way to modify the grammar so the expected operator precedence is reflected in the AST?
2. Or is there a way to use the tree construction class to modify the AST?
Any help here would be appreciated.