Package

Source Code of IRDemoMain

import java.io.IOException;

import ro.pub.cpl.irparser.*;

import org.antlr.runtime.ANTLRFileStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;

public class IRDemoMain {

  /**
   * @param args
   */
  public static void main(String[] args) {
    if (args.length != 1) {
      System.out.println("Usage: java -jar IRDemo.jar <file.ir>");
    }
    else try {
      ANTLRFileStream input = new ANTLRFileStream(args[0]);
      IRLexer lexer = new IRLexer(input);
     
      CommonTokenStream tokens = new CommonTokenStream (lexer);
      IRParser parser = new IRParser(tokens);
       
      parser.irfunction();
    } catch (IOException e) {
      System.err.println("Could not process IR file : " + e.getMessage());
    } catch (RecognitionException e) {
      System.err.println("IR could not be parsed: " + e);
    } catch (RuntimeException e) {
      System.err.println("IR could not be parsed: " + e);     
    }
  }

}
TOP

Related Classes of IRDemoMain

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.