expr : ID '(' expr ')' // valid grammar rule | INT // valid grammar rule | ID '+=' INT // mismatched set ;
expr : ID ( '+' ID )* // valid grammar rule | INT // valid grammar rule | ID '+' '*' ID // mismatched set ;The last rule also does not match any of the valid sets of tokens defined by the other rules, and would result in a MismatchedSetException being thrown. The Antlr.Runtime library is a C# package that provides a set of tools and classes for working with ANTLR generated parsers and lexers.