3 ms·
I am not sure the "unlockable" features idea is a good one. Firstly, that seems to imply that students will first learn what "simple error message" means, and
by Someone 12y ago
I am not sure the "unlockable" features idea is a good one.
Firstly, that seems to imply that students will first learn what "simple error message" means, and later, when they make the same mistake, get shown "gobbledygook gook gook". Why would they spend time learning that new message, if, for all they know, a few lessons on, the same mistake may produce yet another error message?
Secondly, the good student may generalize from the subject of a lesson (for example because they may have experience with another language), guess at advanced syntax and try it out, and hurt their nose because their language doesn't _yet_ support the feature.
I would think that the only good way forward is to spend time improving the error messages in the full language. Possibly, that requires redesigning the language (for example, having if...fi, do...od, and while...wend may be superior to using braces everywhere)
Yes, that is hard work. In many languages, writing a parser that accepts valid programs is way easier than writing a parser that gives meaningful error messages and recovers from errors in the to be parsed code well.
If you have that, maybe, labeling parts of error messages as 'irrelevant for this lesson' by graying them out might help, but I think you should present all possible causes of parse errors up front.
[aside: from the title alone, I guessed this was a game where achievements allowed you to buy language features: "your next task is to draw a Pythagorean tree. You have 367 coins. You can buy recursive function calls for 100 coins, Unicode emoji output for 150, floating point arithmetic for 250, or goniometric functions for 200?"]
- TheLoneWolfling 12y agoAgreed on all parts, give or take. An addition: I don't see how one could suppress error messages relating to features that haven't been unlocked without causing program validity itself to be dependent on what features you have unlocked. Either that or have programs that don't have any observable error messages but still don't work. And that's a nasty side effect. Note that a recursive-descent parser is actually probably the best approach for this. They have the combination of being simple and relatively easy to generate relevant error messages and recover from errors that you often don't get with other parsers. The classic shortfall of a recursive-descent parser (exponential-time worst case complexity) doesn't generally apply to this sort of thing, as generally the programs are relatively short.