[antlr-interest] ANTLR Optional statements

jg z zjg1964 at yahoo.com
Fri Apr 5 06:44:19 PST 2002


We are trying to convert a C++ Parser from PCCTS to
ANTLR, and becoming increasingly frustrated by the
differences between the two systems.

For instance;

In cplusplus.g we have,

class_head
   :  (  STRUCT  
      |  UNION 
      |  CLASS 
      )
      {ID { base_clause } }
   ;

which works fine in PCCTS.

For ANTLR we have converted this to,

class_head
   :	
    (  STRUCT  
    |  UNION 
    |  CLASS 
    )
    (ID ( base_clause)? )?
   ;

However, the optional statements shown at the end of
this production no longer produces a properly optional
construction in the generated .cpp file.

What are we supposed to do?

David.


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

 

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



More information about the antlr-interest mailing list