[antlr-interest] AntLR grammar problems.

Bharath S payasam79 at yahoo.com
Thu Mar 25 12:23:46 PST 2004


Hi grp,

My antlr grammar seems to behave strangely, offlate.
For example, I have a lexer rule:

IDENTIFIER: ('a'..'z');

I have a parser rule associated with it:
-------------------------------------
idList returns [String strs="zilch"]
{String s;}
: x: IDENTIFIER {strs = x.getText();}
;
-------------------------------------

When I run Main.java and type the character 'a' (when
i type it, i dont include the single quotes) and it
says:

"line 1:1: expecting IDENTIFIER, found 'a'".

This happened earlier but the mistake disappeared by
itself. Also, when i try delete the lexer so that i
would recreate the lexer instead of overwriting it, it
often says "OUT OF SYNC WITH THE SYSTEM".

Can anybody shed some light on this?

Bharath.

--- Terence Parr <parrt at cs.usfca.edu> wrote:
> Hi  I have a lab using JBurg to generate code in
> conjunction with 
> ANTLR.  Google jburg and check the lab out also at
> my USF course notes. 
> :)
> 
> Ter
> On Mar 11, 2004, at 8:13 AM, Bharath S wrote:
> 
> > Hi All,
> >
> > My understanding is that AntLR can be used to
> generate
> > the front-end of a compiler (lex-parser-AST). What
> > about the backend? (code
> generation/optimization?). As
> > of now, I am getting clear ideas about defining
> the
> > "structured text" language's syntax+semantics; How
> > would i convert it to bytecode?
> >
> > Thanks a lot.
> >
> > Bharath.
> >
> > =====
> > Bharath Sundararaman
> > Graduate Assistant, CAHS.
> > (312)-5606532 (M)
> > http://www.cs.uic.edu/~bsundara
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Search - Find what you’re looking for
> faster
> > http://search.yahoo.com
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> --
> Professor Comp. Sci., University of San Francisco
> Creator, ANTLR Parser Generator,
> http://www.antlr.org
> Cofounder, http://www.jguru.com
> Cofounder, http://www.knowspam.net enjoy email
> again!
> Cofounder, http://www.peerscope.com pure link
> sharing
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
>      antlr-interest-unsubscribe at yahoogroups.com
> 
>  
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list