Hello, so I decided to tackle the interpreter challenge in C++, and for some reason, it fails at the second test (the random integer age one). Now, I usually take the test scripts and test them locally myself to see if I didn’t flub something up, but this time, while the tester fails, the local interpreter did not actually throw a parsing error and went through the script as the tester expected (tester got a ‘Expected ; after expression’ message for some reason. I cannot debug myself as this is a problem only reproducible on the testers. If you can access my code, then perhaps you can try compiling it on your end and see whether it works? (To get as close as possible to the tester’s condition, I elected to build and debug using WSL.)
In desperation, I tried adding some hacky checks for the tester so it can proceed anyway, so don’t mind the macro in main.cpp. (I managed to get past that step of the challenge after setting a hacky patch up, but I will remove said patch once the challenge is finished.)
Here is the test Lox script:
var age = 30; // The integer actually changes
if (age > 18) print "adult"; else print "child";
Hey @fortwoone, could you upload to GitHub a version of your code without the hack and share the link? It will be much easier to debug if I can run it directly.
I do have access to your current code that includes the hack. It would be super helpful if you could also share a version that works locally without the hack.
@fortwoone Feel free to test locally using quoted strings inside comments:
// This program initializes age with a random integer and then prints "adult"
// if the age is greater than 18, otherwise it prints "child"
var age = 42;
if (age > 18) print "adult"; else print "child";