3 ms·
It's a balancing act between designing syntax that makes sense for the programmer and syntax that makes sense for the parsing technology. I'd feel a bit silly
by chrisseaton 10y ago
It's a balancing act between designing syntax that makes sense for the programmer and syntax that makes sense for the parsing technology.
I'd feel a bit silly explaining to someone that some twisted or ugly syntax construct was like that because it made writing the parser a bit easier, when the parser only has to be written once but the syntax has to be used in every program written using the language.
- barrkel 10y agoCode that's hard to parse is easy to get wrong in surprising ways. Difficulty in parsing almost always means ambiguous parses that need to be resolved with sufficient lookahead or semantic lookup; if the user makes a mistake, it may be in one of the ambiguous cases, which leads to surprise. In particular, error messages are impossible to keep clearly prescriptive in every case, because thy needs to take account of the inherent ambiguity.