[antlr-interest] Serious Bug when using BitSetgeneration

Terence Parr parrt at cs.usfca.edu
Wed Nov 9 14:55:35 PST 2005


On Nov 9, 2005, at 11:34 AM, Olivier Dragon wrote:
> I've created a simpler test which might help identify this.  To get  
> the
> correct behaviour I have to increase the codeGenMakeSwitchThreshold
> above the number of alternate paths. Here is the grammar used with the
> default codeGen value.

[snip]

> OP: ".gt.";
>
> NUMERAL:
> 	('0'..'9')+ // integer
> 	(
> 		'h' | // hex
> 		('.' ('0'..'9'| ~('g') )) => '.' ('0'..'9')* // real
> 	)?
> 	;

First, why is this not what you want:

NUMERAL:
	('0'..'9')+ // integer
	(
		'h' // hex
	|	'.' ('0'..'9')* // real
	)?
	;

Why the predicate?  Set k=2 and it should work perfectly.

That said, it seems to be a bug (different than Geir's bug) that the  
switch threshold causes the pred to be generated or not...hmm...

Ter


More information about the antlr-interest mailing list