=?gb2312?q?=BB=D8=B8=B4=A3=BA=20RE:=20[antlr-interest]=20So=20I=20wish=20?=
=?gb2312?q?one=20token=20has=20two=20types?=
=?gb2312?q?=CB=EF=BC=CD=B8=D5=20Jigang=20(Robert)=20Sun?=
sunjigang1965 at yahoo.com.cn
Wed Jun 7 14:37:49 PDT 2006
--- Micheal J wrote:
> Jigang,
>
> > I have two kinds of tokens, CHAR and ID, to identify
> >
> > CHAR: LowerCaseChar;
> > ID: (LowerCaseChar)+;
> >
> > a single char, e.g. 's', could be either type of CHAR of ID,
>
> Can't be resolved in a lexer (well, it may be possible but it usuallly gets
> very messy). Let the parser resolve it.
>
If the grammar is
CHAR: LowerCaseChar;
id: (CHAR)+;
What got is a tree other than a token/string. So I have to use actions to get the string. Do you
mean token/string creation should be done in parser?
Jigang
__________________________________________________
¸Ï¿ì×¢²áÑÅ»¢³¬´óÈÝÁ¿Ãâ·ÑÓÊÏä?
http://cn.mail.yahoo.com
More information about the antlr-interest
mailing list