[antlr-interest] How to get tokens to come out as (char *) types

Sunil Sawkar ssawkar at aehr.com
Thu Oct 14 11:14:38 PDT 2010


Hi,

I am using the following options for my grammar:

options {
	language=C;
	output = AST;
	backtrack = true; 
}

I would like to use  TokenLabelType  option to get all my tokens to come out 
as (char *) type to be easily manipulated in "string" class. For now I am 
using this cast, for example:   (char *)$ID.text->chars.

I don't understand the usage TokenLabelType=MyToken; suggested in the 
Definitive ANTLR reference.

Can anyone suggest a solution to avoid casts in hundreds of places ?

Appreciate the help..

-Sunil S
(New to ANTLR)


More information about the antlr-interest mailing list