My code works for all cases but Validator #2, “Simple Comparison”. Therefore it is difficult for me to understand and debug…
Is the test case representative of the validator case or does it leave out some subtlety?
My code works for all cases but Validator #2, “Simple Comparison”. Therefore it is difficult for me to understand and debug…
Is the test case representative of the validator case or does it leave out some subtlety?
Validator 2 (“Simple Comparison”) looks pretty similar to Test 2.
Test 2: (2>5)+2*(5>2)+4*(10>5)
Validator 2: (a>b)+2*(c>d)+4*(e>f)
and:
Thank you! I could find and solve the bug. For reference, my code was doing this:
In other words, it did not compute parentheses first, and somehow this error cancelled itself in test case 2. It was a simple fix (recursive call to the same function).
Did you guys do a compiler construction course before.
I didn’t, so I wrote a tokenizer/lexer, a parser, another parser because the first one was not capable to prioritize operators. It’s actually slightly too powerfull, because it can parse nested loops. And then an tree eval function. All a bit clunky , including by reinventing the Map datatype. But it all really helped me a bit, unfortunatly I did not finish in time for the event.
There is actually a small increase in complexity, because the [[-]] operator is overloaded to be both an unary and binary operator.