This project has moved. For the latest updates, please go here.

not recognising a funCall

May 5, 2010 at 5:15 PM

I can't get the parser to recognise a function call.



What I have is very similar to the SQL example, where:


expression.Rule = term | unExpr | binExpr;


 term.Rule = Id | string_literal | number | funCall;


 funCall.Rule = Id +"(" + funArgs + ")";


funArgs.Rule = exprList;




Any thoughts?
















May 5, 2010 at 5:38 PM

What do you mean "not recognizing"? Do you get grammar errors? or parser error? Please give more details

May 5, 2010 at 8:25 PM

I dug in with the Grammar Explorer, found the state that was causing it, and resolved the issue -- I was using rounded brackets instead of square brackets as per the definition. I did swap it back and forward a few times when testing earlier, but oh well, it now works.

I guess I'm not sure why it's saying that it needs to find sum/multiplicative/relational operators VS open/close braces, as the former aren't defined in the function definition.

The big question would be how do you intercept an error like this and make it more meaningful for a user.

State S48 (Inadequate)
  Shift items:
    Id -> Id ·. IdAtom
    FunctionCall -> Id ·( ExpressionList )
  Reduce items:
    Term -> Id · [+ - * / ^ = > < >= <= <> and or ) , ;]
  Transitions: .->S23, (->S59