[antlr-interest] Tree Parsers (C++)

Hrvoje Nezic hrvoje.nezic at envox-lab.hr
Fri Dec 6 03:23:42 PST 2002


I have a legacy project written in C/C++ using 
Zyacc (a variant of Yacc). The language I have to parse 
accepts Unicode characters in identifiers.

Because ANTLR for C++ currently doesn't support Unicode,
I had to write my own lexer (actually, I modified existing one).

I wrote MyTokenStream and MyCommonToken classes.
MyCommonToken includes information about the token
in form of a C union.

I cannot just redefine getText because this method returns
ordinary string, and my token information is not a string,
but a complex structure.

I would like to be able to have access to this structure
in my tree parser, perhaps like this:

expr   // tree parser expr
:
     id : IDENT { do_something_with (id->my_token_information) ; }
;

Actually, I need to access MyCommonToken objects
within the tree parser, but I don't know how to achieve this.

I would appreciate your help.

Regards,
Hrvoje Nezic



 

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



More information about the antlr-interest mailing list