@Algorithm(lalr, 1) // Very simple expression language, that uses precedence annotations to determine // precedence. // Note that it is LALR. Expr: if Expr | Expr + Expr | Expr - Expr | Expr * Expr | - Expr | INT // Precedence annotations @precedence(Expr, 0, right = 1) @precedence(Expr, 1, left = 2, right = 3) @precedence(Expr, 2, left = 2, right = 3) @precedence(Expr, 3, left = 4, right = 5) @precedence(Expr, 4, right = 6) @example(INT + INT) @example(INT + if INT + INT) @example(INT + INT - INT) @example(INT * INT + INT) @example(INT * if - INT + if INT) @example(INT * INT + - INT * INT)