
Am Di., 20. Apr. 2021 um 12:57 Uhr schrieb Benjamin Redelings < benjamin.redelings@gmail.com>:
[...] I'm still curious about why the GHC parser does not use a grammar that is closer to the language grammar. Is this mostly for historical reasons? Are GLR parsers too slow? I don't know what fraction of the compilation time is spent in parsing, but would suspect it is not that much.
I think there are various aspects: * Tool support (i.e. historic reasons): Happy is a LALR parser generator. * Quality of error reporting: I don't have a clue how good GLR parsers are in this area. Often more powerful parsing methods have horrible reporting, at least that's my impression. * Does the GLR parser generator detect ambiguities and report them to the grammar writer? To me, ambiguities (like the shift/reduce & reduce/reduce conflicts in LALR parsing) are a big red flag and a sign of a questionable language/grammar: Even if the generator/parser is able to figure things out correctly, humans have a much harder time. Cheers, S.