Package ro.pub.cpl.coolir

Source Code of ro.pub.cpl.coolir.Main

package ro.pub.cpl.coolir;
import java.io.IOException;

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

public class Main {
  public static void main(String args[]) {
    try {
            ANTLRFileStream input = new ANTLRFileStream(args[0]);
            CoolIrLexer lexer = new CoolIrLexer(input);
      CommonTokenStream tokens = new CommonTokenStream(lexer);
      CoolIrParser parser = new CoolIrParser(tokens);
     
      Program p = parser.program();
     
      System.out.println(p);
      // TODO: build control flow graph
      // TODO: perform data flow analysis
      // TODO: perform optimization
     
     
    } catch (IOException e) {
      System.out.println("Error: " + e.getMessage());
    } catch (RecognitionException e) { 
      System.out.println("Recognition Error: " + e.getMessage());
    }
  }
}
TOP

Related Classes of ro.pub.cpl.coolir.Main

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.