[antlr-interest] A bug about expression?

Daisuke OKAJIMA okajima at poderosa.org
Sat Aug 27 23:16:10 PDT 2005


 Hi,

 I found a suspicious behavior about antlr 2.7.5, and extracted a small
sample grammar to reproduce the behavior. The grammar file is attached.

 In the sample, there are two expressions e1 and e2. 

e1
	: e2 (COMMA e2)?
	;

e2
	: NUMBER
	| LP e1 RP
	;

 On the contrary, the generated source code for the expression e1
accepts "e2 RP" as input. This is the reason of the suspicious behavior I
found first.

public final void e1() throws RecognitionException, TokenStreamException {
  e2();
  switch ( LA(1)) {
  case COMMA:
    ...
  case RP:
  {
    break;
  }
  ....

 Does anybody have information about this behavior?

 regards,

-- 
Daisuke OKAJIMA <okajima at poderosa.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample.g
Type: application/octet-stream
Size: 313 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20050828/91424396/sample.obj


More information about the antlr-interest mailing list