@Algorithm(lalr, 1) // Example of a grammar that forbids chaining comparisons. Expr: Expr + Expr | Expr * Expr | Expr == Expr | Expr != Expr | INT @precedence(Expr, 0, left = 3, right = 4) @precedence(Expr, 1, left = 5, right = 6) @precedence(Expr, 2, left = 1, right = 2) @precedence(Expr, 3, left = 1, right = 2) // We only need to forbid on the left: it is already forbidden on the right // because of operator precedence. @forbid(Expr, 2, 0, Expr, 2) @forbid(Expr, 2, 0, Expr, 3) @forbid(Expr, 3, 0, Expr, 2) @forbid(Expr, 3, 0, Expr, 3) @example(INT + INT * INT == INT) @example(INT != INT * INT) @example_fail(INT == INT == INT) @example_fail(INT + INT != INT + INT * INT == INT)