3 ms·
The equivalent of garden-path sentences in formal languages would be shift-reduce conflicts and most pedanticly strict grammars are specifically designed to avo
by yorwba 11y ago
The equivalent of garden-path sentences in formal languages would be shift-reduce conflicts and most pedanticly strict grammars are specifically designed to avoid that kind of problem, so that they can be parsed efficiently.
- efaref 11y agoOf course the compiler has no problem understanding them, but humans aren't that good as parsing. The purpose of a syntax highlighter is so that the human knows that the computer agrees on what the sentence/code structure is.