-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import lexer.Lexer; | ||
import lexer.LexerImpl; | ||
import parser.Parser; | ||
import parser.ParserImpl; | ||
import interpreter.Interpreter; | ||
import interpreter.InterpreterImpl; | ||
|
||
public class Executor { | ||
|
||
private Lexer lexer; | ||
private Parser parser; | ||
private Interpreter interpreter; | ||
|
||
public Executor(){ | ||
this.lexer = new LexerImpl(); | ||
this.parser = new ParserImpl(); | ||
this.interpreter = new InterpreterImpl(); | ||
} | ||
|
||
public void execute(String file){ | ||
interpreter.interpret(parser.parse(lexer.lex(file))); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class ExecutorTest { | ||
|
||
@Test | ||
public void executeLines(){ | ||
Executor executor = new Executor(); | ||
|
||
String program = "let foo : number= 5;\n" + | ||
"let bar :number = foo + 4;\n" + | ||
"print(bar + \"is a\" + \'word\');\n"; | ||
|
||
executor.execute(program); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package interpreter; | ||
|
||
import ast.ASTNode; | ||
|
||
public interface Interpreter { | ||
void interpret(ASTNode program); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package interpreter; | ||
|
||
import ast.ASTNode; | ||
|
||
public class InterpreterImpl implements Interpreter { | ||
@Override | ||
public void interpret(ASTNode program) { | ||
|
||
} | ||
} |