Skip to content
This repository was archived by the owner on Feb 26, 2018. It is now read-only.
This repository was archived by the owner on Feb 26, 2018. It is now read-only.

REPL #11

@at15

Description

@at15

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

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();
    }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions