return compile(reader, new BasicTokenHandler());
}
public static AssemblyScript compile(Reader reader, TokenHandler tokenhandler) throws IOException
{
AssemblyScript script = new AssemblyScript();
//Read each line of the script
BufferedReader bufferedreader = new BufferedReader(reader);
String line;
while ((line = bufferedreader.readLine()) != null) {
String[] tokens = line.split("\\s"); //split by whitespace
Instruction instruction = tokenhandler.getInstructionByToken(tokens[0]);
instruction.readParametersFromTokens(tokens);
script.push(instruction);
}
return script;
}