FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Dobbs M-Dev
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
March 01, 1999

Compiler Construction with ANTLR and Java

(Page 3 of 9)
Mar99: Compiler Construction with ANTLR and Java

Compiler Construction with ANTLR and Java

By Gary L. Schaps

Dr. Dobb's Journal March 1999

// ... parse the file ...
public static void parseFile(InputStream s, String fname) 
    throws Exception {  
    try {
        // Create a scanner that reads from the input stream
        KPLLexer lexer = new KPLLexer(s);
        // Create a parser that reads from the scanner
        KPLParser parser = new KPLParser(lexer);
        parser.setCurrentFile(fname);
        // start parsing at the compilationUnit rule
        parser.compilationUnit();
        ...

Example 2: Starting the parser.


Copyright © 1999, Dr. Dobb's Journal
Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK