/**** * * Testing driver for the FMSL for the reduced-grammar parser generated by * SableCC. This file was copied and hacked from the minibasic example in the * SableCC sample grammars distribution. * * @author gfisher@calpoly.edu */ package parser; import parser.node.*; import parser.lexer.*; import parser.parser.*; import java.io.*; public class Main { public static void main(String[] arguments) { if(arguments.length != 1) { System.out.println("usage:"); System.out.println(" java parser.Main file.fmsl"); System.exit(1); } try { Lexer lexer = new Lexer( new PushbackReader( new BufferedReader( new FileReader(arguments[0])), 1024)); Parser parser = new Parser(lexer); Node ast = parser.parse(); System.out.println(ast); } catch(Exception e) { System.out.println(e); } } }