/**
 * Main method for the SILLY Interpreter. 
 * 
 * @author Dave Reed 
 * @version 2/10/12
 */
public class Interpreter {
    
    /** 
     * Main method for starting the SILLY interpreter.
     */
    public static void main(String[] args) throws Exception {        
        TokenStream input;
        if (args.length == 0) {
            input = new TokenStream();
        }
        else {
            input = new TokenStream(args[0]);
        }
        
        Bindings bindings = new Bindings();
        
        Statement stmt;
        do {
            if (args.length == 0) {
                System.out.print(">>>");
            }
            stmt = Statement.getStatement(input);
            stmt.execute(bindings);
        } while (stmt.getType() != Statement.Type.QUIT);

    }
}
