This project has moved and is read-only. For the latest updates, please go here.
1
Vote

What does this error "Transient non-terminal must have zero or one non-punctuation child nodes; non-terminals: PAREN_EXPR ASSIGN_DATAREF_STMT setExpressionRecursiveStmt."

description

What does this error "Transient non-terminal must have zero or one non-punctuation child nodes; non-terminals: PAREN_EXPR ASSIGN_DATAREF_STMT setExpressionRecursiveStmt." in languagedata of Irony

comments

rivantsov wrote Jun 19 at 6:17 PM

Ok, here's quick explanation.
Transient nodes are those that can/should be removed from the result Parse tree, to make it less littered with useless nodes.
For example, here's expression grammar:

expr -> number | variable | binExpr
binExpr -> expr + "+" + expr

after parsing expression:
x + 3

the result is : expr(binExpr, expr(variable), "+", expr(number))
  • a tree , X(Y) means Y is a direct child of X
Now, looking at this tree, it's obvious that 'expr' nodes are not meaningful, we can simplify it to

binExpr(variable, "+", number)

Irony parser can do it automatically if you mark expr as Transient - meaning that remove it from output tree, it is NonTerminal used in clearer grammar rules definition, but not actually needed in the output.
Transient node must be a pipe (OR, |) of one or more other terms, so it can be removed and its single child can be put directly under its parent.

KalaiselviAthi wrote Jun 20 at 7:16 AM

Thank you Ivan . I will try it :)