3 ms·
>parser (decidable! easily-analyzable memory bounds!), Hahaha, you wish. Sure there are languages that are simple to parse, but they are that way by constructi
by contravariant 6y ago
>parser (decidable! easily-analyzable memory bounds!),
Hahaha, you wish. Sure there are languages that are simple to parse, but they are that way by construction. Parsing arbitrary grammars is hard to impossible depending on how general your class of grammars is.
- morelisp 6y agoI'm well aware of the limitations of some classes of parsers. > but they are that way by construction If I could summarize both this and the original "parse, don't validate" article, it would be "let's construct as much as possible this way."
- contravariant 6y agoFair enough but it wouldn't surprise me if you just get the exact same problems you get with type systems except phrased differently. You already hinted at this somewhat with your "num = num + num" example, surely that's just a type system in disguise? And well, personally I view types more like a way to denote pre- and post-conditions (with varying degrees of strictness). And a grammar just tells you what you are allowed to write, it doesn't dictate semantics. This becomes a problem when you get stuff like "daily_revenue + temperature", which grammatically makes perfect sense, but semantically does not. With types this can be fixed (admittedly in this case it might not be worth fixing), in a grammar this seem very hard to forbid.