This repository was archived by the owner on Feb 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on Feb 26, 2018. It is now read-only.
REPL #11
Copy link
Copy link
Closed
Description
Read eval print loop is very useful for play with a language, we already have a shell class working, but the naive interpreter is not integrated with it, following issue need to be resolved before this can move on
- error handling in ANTLR Minor ANTLR issues #5
- line number in statements Minor AST Issues #6
TODO
- point out parse error
- point out error when building AST
- eval
- execute system command
- screen recording using https://asciinema.org
Bug
- astBuilders should use one symbol table, other wise the following error occurs
- use one ast builder for irk
- disable clear symbol a90c194
⇒ ./irk
Reika shell, version 0.0.1: https://github.com/xephonhq/tsdb-proxy-java
> int a = 1;
1
> a = 3;
1 symbol errors, 0 type errors
1:0 a is undefined
Cool features
- revert, revert the state change caused by previous statement
Ref
erros/TestE_Listener2.java from guide
protected void underlineError(Recognizer recognizer,
Token offendingToken, int line,
int charPositionInLine) {
CommonTokenStream tokens =
(CommonTokenStream)recognizer.getInputStream();
String input = tokens.getTokenSource().getInputStream().toString();
String[] lines = input.split("\n");
String errorLine = lines[line - 1];
System.err.println(errorLine);
for (int i=0; i<charPositionInLine; i++) System.err.print(" ");
int start = offendingToken.getStartIndex();
int stop = offendingToken.getStopIndex();
if ( start>=0 && stop>=0 ) {
for (int i=start; i<=stop; i++) System.err.print("^");
}
System.err.println();
}