4 ms·
If you can construct an AST, you’ve moved past the syntax stage.
by lilyball 7y ago
If you can construct an AST, you’ve moved past the syntax stage.
- dbcurtis 7y agoWell, in a pure sense, you are correct. But for practical reasons, it can sometimes be easier to define a parsing grammar that is a little loose, and pick up the stragglers by analyzing the AST. Sometimes the “correct” grammar is needlessly complex and you can reduce the headaches with a quick sanitation pass over the results of a less pure parser.
- lilyball 7y agoEven so, I wouldn't consider this a syntax error, because the error isn't with the syntax but with using an identifier in a context where that particular identifier isn't allowed (but others are). This would make it more akin to a NameError.