Hi
I have a simple LALR(1) grammar, but I'm encountering a problem.
start ::= spec.
spec ::= MOD STRING top_stmt.
spec ::= top_stmt.
top_stmt ::= stmt.
top_stmt ::= conditional.
stmt ::= expr.
stmt ::= assignment.
conditional ::= IF stmt_list.
expr ::= retval.
expr ::= NOT retval.
retval ::= access.
retval ::= invoke.
access ::= ns_identifier OBJECT_OPERATOR property_chain.
access ::= ns_identifier.
ns_identifier ::= identifier.
ns_identifier ::= ns_identifier NS_SEPARATOR identifier.
ns_identifier ::=.
property_chain ::= property_chain OBJECT_OPERATOR identifier.
property_chain ::= identifier.
identifier ::= VARIABLE.
identifier ::= STRING.
assignment ::= access ASSIGN expr. [ASSIGN]
stmt_list ::= stmt.
stmt_list ::= stmt_list COMMA stmt. [COMMA]
invoke ::= access LPAREN empty_stmt_list RPAREN.
empty_stmt_list ::=.
empty_stmt_list ::= stmt.
empty_stmt_list ::= empty_stmt_list COMMA stmt. [COMMA]
The dot marks the end of the rule, terminals between brackets have associativity assigned to them: ASSIGN is right-associative, COMMA is left-assoc.
But lemon says it can't reduce the rule "empty_stmt_list ::=." because it's not connected to the start symbol. I bet it is :-)
There is also a parsing conflict for "invoke", it cannot decide between RPAREN and COMMA when empty_stmt_list is indeed an empy list of statements.
What I'm trying to achieve is being able to parse function calls which have no (void) parameters.
Everything else works as expected.
Thanks
Edit: I have edited my original post and posted the entire stripped down grammar.