[antlr-interest] Tutorial Seems to Have Improper Java

Terence Parr parrt at cs.usfca.edu
Thu Nov 18 14:49:41 PST 2004



On Nov 18, 2004, at 1:45 PM, Matthew Tedder wrote:
> While I code in C/C++ and flex/bison, I am new to Java
> and trying to learn antlr, too.  The following link is
> to code I found in an antlr tutorial:
>
> http://pastebin.com/121239
>
> But it doesn't work.. javac says it's expecting '{'
> after:
>
> class ExrLexer extends lever;
>
> Can anyone tell me what is wrong here?  Once I get
> just one simple thing working, I think I could be
> happy playing with it for a while..

Somebody has the main and .g file looking like one.  Make this a 
separate file:

import antlr.*;
public class Main {
  public static void main(String[] args) throws Exception {
    ExprLexer lexer = new ExprLexer(System.in);
    ExprParser parser = new ExprParser(lexer);
    parser.expr();
  }
}

Ter
--
CS Professor & Grad Director, 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!





 
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