nit: printing repl prompter is not correct in kaleidoscope example
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
In [main loop](https://github.com/llvm/llvm-project/blob/main/llvm/examples/Kaleidoscope/Chapter2/toy.cpp#L406) 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:
```cpp
static void MainLoop() {
while (true) {
switch (CurTok) {
...
case ';': // ignore top-level semicolons.
fprintf(stderr, "ready> ");
getNextToken();
break;
...
default:
HandleTopLevelExpression();
break;
}
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.