Okay, maybe I'm seeing things, but I can't understand why the supplied Jack compiler doesn't want to compile this:
class Main {
function void main() {
var int a;
let a = 1;
if (a>0) {
do Output.printInt(1);
}
return;
}
}
On my system, it fails with the error:
In Main.jack (line 5): In subroutine main: Expected statement(do, let, while, return or if)
The file is called Main.jack and is the only file in its directory named "test", and I'm calling "JackCompiler test".
This is especially weird beause the supplied compiler compiles much more complicated programs without a hitch. I'm in the middle of doing Project 12, so I've used the compiler many times before, but never ran into this. My own compiler, which I wrote in project 11, compiles the file without errors.
So:
1. Is there something trivial I'm overlooking?
2. Can you try the above program on your system? Does it compile using the supplied compiler?
3. Any explanation?