[antlr-interest] Understanding non LL(*) errors

franck102 franck102 at yahoo.com
Thu Nov 24 00:57:47 PST 2011


Hi, I am new to grammar design and I am still struggling with understanding
non LL(*) errors.

In the example below I do understand that "call f using 1, 2" is ambiguous,
which I am trying to address with the greedy option, but I still get a fatal
error trying to compile the grammar.

I am looking for general tips that would help me get from such an error
message (the actual grammar is complex and those errors keep coming up with
every change) to a specific input example where I can understand which rule
sequence would send antlr into a recursive loop?

Thanks in advance!
Franck

grammar Test;

tokens {
	ON='on';
	COMMA=',';
}
	
callExpression
	:	primaryExpression
	|	'call' primaryExpression ( 'using' primaryExpression ( options
{greedy=true;} : COMMA primaryExpression )* )?
	;
	
primaryExpression
	:	'(' callExpression ')'
	| 	ID
	;
	
argumentList
	:	callExpression ( COMMA callExpression )*
	;
	
// $>

// LEXER
// ==========================================

ID
	:	('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
	;

--
View this message in context: http://antlr.1301665.n2.nabble.com/Understanding-non-LL-errors-tp7027459p7027459.html
Sent from the ANTLR mailing list archive at Nabble.com.


More information about the antlr-interest mailing list