21:42 | <kriskowal> | What is a cover grammar? Where does one go to learn more about them? |
23:01 | <jmdyck> | Well, there's https://v8.dev/blog/understanding-ecmascript-part-4 |
23:04 | <jmdyck> | A cover grammar, at least the way the ES spec uses it, is sort of a hack to avoid a conflict in a bottom-up parser. |
23:16 | <Chris de Almeida> | What is a cover grammar? Where does one go to learn more about them? |
23:29 | <jmdyck> | That definition says "to remain context free and unambiguous", but the grammar would certainly still be context free without the cover, and it would in some cases also be unambiguous. |
23:33 | <jmdyck> | (E.g., in the case that CoverParenthesizedExpressionEtc deals with, there's no ambiguity: either the parenthesized thing is followed by an => or it isn't, and that tells you whether it's a ParenthesizedExpression or ArrowFormalParameters. The problem is, that token is arbitrarily far away from where you would have to start taking different parse actions for the two possibilities.) |
23:36 | <Chris de Almeida> | That definition says "to remain context free and unambiguous", but the grammar would certainly still be context free without the cover, and it would in some cases also be unambiguous. |