Administrator approval is now required for registering new accounts. If you are registering a new account, and are external to the University, please ask the repository owner to contact ServiceLine to request your account be approved. Repository owners must include the newly registered email address, and specific repository in the request for approval.

Commit f49360ed authored by mutantoe's avatar mutantoe
Browse files

Started work on exec()

parent 7c93e23f
import java.util.ArrayList;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -10,9 +11,9 @@ public class Interpreter {
private String m_code;
private int m_idx;
private Map<String, Integer> m_variables;
public Map<String, Integer> getVariables(String var) {
return m_variables;
......@@ -68,6 +69,31 @@ public class Interpreter {
return token;
public void exec() {
ArrayList<Token> tokenHistory = new ArrayList<Token>();
Token lookahead;
int stmt_begin = 0;
int stmt_end = 0;
// Find next statement
stmt_begin = stmt_end+1;
lookahead = getNextToken();
} while(lookahead.getType()!=TokenType.SEMICOLON);
// Run statement
for (int stmt_idx = stmt_begin; stmt_idx < stmt_end; stmt_idx++) {
Token currentToken = tokenHistory.get(stmt_idx);
switch (currentToken.getType()) {
case CLEAR:
throw new IllegalStateException("Illegal token type: "
+ Token.tokenTypeToString(currentToken.getType()));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment