/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This file is part of MiniBasic. * * See the file "MiniBasic-LICENSE" for Copyright information and * * the terms and conditions for copying, distribution and * * modification of MiniBasic. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ package org.sablecc.minibasic; import org.sablecc.minibasic.node.*; import org.sablecc.minibasic.lexer.*; import org.sablecc.minibasic.parser.*; import org.sablecc.minibasic.tool.Version; import java.io.*; public class Main { public static void main(String[] arguments) { System.out.println(Version.banner()); if(arguments.length != 1) { System.out.println("usage:"); System.out.println(" java minibasic.Main filename"); 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(); ast.apply(new Interpreter()); } catch(Exception e) { System.out.println(e); } } }