This relates to expression grammar changes. #1019
(>1)
as a condition. That adds an unnecessary layer of nesting. I think it would be better to have Expression #void, and a new node AssignmentExpression with no child operator node, instead the operator is on the image. This is consistent with how we don't push e.g. additive expression nodes if there is no additive operation mentioned -> it makes no sense to push ASTExpression if there is no assignment operator.a + b + c - 1
would be parsed as an ASTAdditiveExpression with an image equal to "-", throwing away the fact we saw "+" twice. The same happens with MultiplicativeExpression.I see three possible options:
AdditiveExpression
+ a (...)
+ AdditiveOperator "+"
+ b (...)
+ AdditiveOperator "+"
+ c (...)
+ AdditiveOperator "-"
+ 1 (...)
Matching additive expressions with eg AdditiveExpression[@Operator="+"]
wouldn't be possible anymore.
AdditiveExpression "-"
+ AdditiveExpression "+"
+ AdditiveExpression "+"
+ a (...)
+ b (...)
+ c (...)
+ 1 (...)
AdditiveExpression "-"
+ AdditiveExpression "+"
+ a (...)
+ b (...)
+ c (...)
+ 1 (...)
IMO that's a good compromise. String concatenations, even big, would be flat, because they use only "+". The increased nesting is in fact consistent with how nesting of expressions of different precedences is done (eg a + b * c
has two levels -> why not a + b - c
?).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4