[antlr-interest] Why is this nondeterminism

Trey Spiva Trey.Spiva at embarcadero.com
Tue Jun 18 09:35:53 PDT 2002


> Something is probably calling eventStatement somehow?  Also what is the
> type
> rule?

type
  : name
  | builtInType
  ;

builtInType
  : "boolean"
  | "integer"
  | "double"
  | "byte"
  | "long"
  | "single"
  | "currency"
  | "decimal"
  | "date"
  | "string"
  | "variant"
  | "object"
  ;

protected 
name
  : IDENT (subScript)? (options {greedy=true;} : DOT^ IDENT (subScript)? )* 
  ;

protected 
subScript
  :  LPAREN (subScriptElement (COMMA subScriptElement)* )? RPAREN
  ;
 
subScriptElement
    : NUM_INT ("to" NUM_INT)?
    ;

> Consider this input:
> 
> EVENT IDENT LPAREN IDENT RPAREN
> 
> it's having a tough time knowing if LPAREN IDENT RPAREN should match the
> optional part of eventStatement or something that follows from something
> calling eventStatement.  By default it will match in eventStatement.  If
> that is the desired behavior then you can turn the warning off with an
> option.  This is similar to the if/else problem which there must be a FAQ
> for...
> 
> Monty
> 
> > -----Original Message-----
> > From: Trey Spiva [mailto:Trey.Spiva at embarcadero.com]
> > Sent: Tuesday, June 18, 2002 9:16 AM
> > To: 'antlr-interest at yahoogroups.com'
> > Subject: [antlr-interest] Why is this nondeterminism
> >
> >
> > I am receiving the errors:
> >
> > warning: nondeterminism upon
> > k==1:LPAREN
> > k==2:IDENT
> > k==3:IDENT,RPAREN,"as"
> > between alts 1 and 2 of block
> >
> > for the following rules.  Can any one give me an idea of
> > why the rules are nodeterministic.
> >
> > eventStatement
> >    : "event" IDENT ( LPAREN eventArgListDef RPAREN )?
> >    ;
> >
> > protected
> > eventArgListDef
> >   : argumentModifiers IDENT ( "as"  type )?
> >   ;
> >
> > argumentModifiers
> >   :  ( argumentModifier )*
> >     {#argumentModifiers = #(#[MODIFIERS,"MODIFIERS"],
> > #argumentModifiers);}
> >   ;
> >
> > protected
> > argumentModifier
> >    : "optional"
> >    | "byval"
> >    | "byref"
> >    ;
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> 
> 
> 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list