[antlr-interest] backtrack + rule arguments + C target

Anton Bychkov bychkov.anton at gmail.com
Thu Apr 1 04:20:16 PDT 2010


Hi.

I have some problems with backtrack option and rule arguments.

Example grammar:

grammar testbt;

options
{
	language = C;
	backtrack = true;
}

expr	
	@init {
		int i = 1;
	}
	:
	num[i] | id[i]
	;


num[int i]	:	'0'..'9'+;
id[int i]	:	'a'..'z'+;

Generated files does not compile with error "error C2065: 'i' :
undeclared identifier".
(The problem is that C target does not insert rule arguments into
argument list of autogenerated 'synpred' functions.)

How can I fix this?


More information about the antlr-interest mailing list