In main loop the prompter ready> is shown on any print, like:
$ ./a.out
ready> def foo(x y) x+foo(y, 4.0);
ready> Parsed a function definition.
ready> def foo(x y) x+y y;
ready> Parsed a function definition.
ready>Parsed a top-level expr
ready>
Instead it should be shown like stated in the documentation:
$ ./a.out
ready> def foo(x y) x+foo(y, 4.0);
Parsed a function definition.
ready> def foo(x y) x+y y;
Parsed a function definition.
Parsed a top-level expr
ready>
It seems, it should be printed only after ; and before getting next token:
static void MainLoop() {
while (true) {
switch (CurTok) {
...
case ';': // ignore top-level semicolons.
fprintf(stderr, "ready> ");
getNextToken();
break;
...
default:
HandleTopLevelExpression();
break;
}
}
}