Skip to content
Snippets Groups Projects
Commit f49360ed authored by mutantoe's avatar mutantoe
Browse files

Started work on exec()

parent 7c93e23f
No related branches found
No related tags found
No related merge requests found
package jrr1g18.bb;
import java.util.ArrayList;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -69,5 +70,30 @@ public class Interpreter {
return token;
}
public void exec() {
ArrayList<Token> tokenHistory = new ArrayList<Token>();
Token lookahead;
int stmt_begin = 0;
int stmt_end = 0;
while(true){
// Find next statement
stmt_begin = stmt_end+1;
do{
++stmt_end;
lookahead = getNextToken();
tokenHistory.add(lookahead);
} 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:
default:
throw new IllegalStateException("Illegal token type: "
+ Token.tokenTypeToString(currentToken.getType()));
}
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment