Consider such a rule in grammar for an LR-family parsing generator (e.g YACC, BISON, etc.):Nonterminal : [ lookahead not in {Terminal1, ..., TerminalN} ] Rule ;It's an ordinary rule, except that it has a restriction: a phrase produced with this rule cannot begin with Terminal1, ..., TerminalN. (Surely, this rule can be replaced with a set of usual rules, but it will result in a bigger grammar). This can be useful for resolving conflicts.The question is, is there a modification of LR table construction algorithm that accepts such restrictions? It seems to me that such a modification is possible (like precedence relations).Surely, it can be checked in runtime, but I mean compile-time check (a check which is performed while building parsing table, like %prec, %left, %right and %nonassoc directives in yacc-compartible generators.)
Negative lookahead in LR parsing algorithm
formal grammars;parsers