Updated to later ver of Irony - Precedence change?

Oct 2, 2015 at 8:41 AM
Hi

I was running a very old version of Irony, prior to the splitting out of the parsing and AST generation. I've just updated to the latest version and am now getting a different parsing with my grammar - a Sql like language.

I've had to move the InvokeValidateToken out of my custom terminals and hook up _ValidateToken event in my grammar as well as remove the DefaultNodeType from the grammar and assign a DefaultNodeCreator function as appropriate. However, those are the only changes I needed to made (other than the various signatures - Init etc - for my own Ast nodes) to get the grammar working error free in Grammar Explorer.

However, the expression

a='b' OR a='1'

where previously parsed as

(a='b') OR (a='1')

is now being parsed as

(a= (b OR a='1'))

It looks to me like it is an operator precedence thing, but that hasn't changed. It is still
            RegisterOperators(100, "*", "/", "\", "%")
            RegisterOperators(90, "+", "-")
            RegisterOperators(80, "=", ">", "<", ">=", "<=", "<>", "!=", "!<", "!>")
            RegisterOperators(70, "^", "&", "|")
            RegisterOperators(60, "NOT", "IS")
            RegisterOperators(50, "LIKE", "IN")
            RegisterOperators(40, "AND")
            RegisterOperators(30, "OR")



Other salient bits of my grammar are:
        expression.Rule = term Or
                          binaryExpression Or booleanExpression Or
                          equalityExpression Or unaryExpression Or
                          nullExpression Or missingExpression Or unknownExpression Or
                          inExpression Or likeExpression Or
                          orderByExpression Or studyExpressionList  

        term.Rule = dataitemKeyExpression Or subjectKeyExpression Or sequenceKeyExpression Or recordNumberExpression Or levelExpression Or
                    numberExpression Or stringExpression Or dateExpression Or quotedExpression   Or
                    functionExpression Or parenExpression Or
                    queryExpression Or queryFilterExpression Or
                    containsCodeExpression Or caseExpression Or parameterExpression Or
                    dataTypeExpression Or deferredExpression 

        parenExpression.Rule = LPAREN + listExpression + RPAREN

        numberExpression.Rule = numberLiteral
        stringExpression.Rule = identifier Or "*"
        binaryExpression.Rule = expression + binaryOperator + expression
        booleanExpression.Rule = expression + booleanOperator + expression
        equalityExpression.Rule = expression + equalityOperator + expression
        functionExpression.Rule = functionNameExpression + parenExpression Or
                                  functionNameExpression + [EMPTYPAREN]
Where else should I be looking to try and resolve this?

Many thx

S
Oct 2, 2015 at 9:49 AM
Try marking your binaryOperator etc. rules with MarkTransient.

Also please search the forums a bit before asking questions, this has come up before.
Oct 2, 2015 at 9:56 AM
Many, many thx for the speedy reply. That worked.