31309bc38c8c16dba200c7d3b0b4299a25f43d41
[IRC.git] / Robust / src / Main / Main.java
1 package Main;
2
3 import java.io.Reader;
4 import java.io.BufferedReader;
5 import java.io.FileReader;
6 import IR.Tree.ParseNode;
7 import IR.Tree.BuildIR;
8 import IR.State;
9
10 /* Test skeleton for java parser/lexer.
11  * Copyright (C) 1998 C. Scott Ananian <cananian@alumni.princeton.edu>
12  * This is released under the terms of the GPL with NO WARRANTY.
13  * See the file COPYING for more details.
14  */
15
16 public class Main {
17   public static void main(String args[]) throws Exception {
18       if (args.length<1) {
19         System.out.println("Must input source file");
20         System.exit(-1);
21       }
22     Reader fr = new BufferedReader(new FileReader(args[0]));
23     Lex.Lexer l = new Lex.Lexer(fr);
24     java_cup.runtime.lr_parser g;
25     g = new Parse.Parser(l);
26     ParseNode p=(ParseNode) g./*debug_*/parse().value;
27     //    System.out.println(p.PPrint(2,true));
28     State state=new State(p);
29     BuildIR bir=new BuildIR(state);
30     bir.buildtree();
31     System.exit(l.numErrors());
32   }
33 }