Arithmetic { Exp = AddExp AddExp = AddExp "+" MulExp -- plus | AddExp "-" MulExp -- minus | MulExp MulExp = MulExp "*" ExpExp -- times | MulExp "/" ExpExp -- divide | ExpExp ExpExp = PriExp "^" ExpExp -- power | PriExp PriExp = "(" Exp ")" -- paren | "+" PriExp -- pos | "-" PriExp -- neg | ident | number ident (an identifier) = letter alnum* number (a number) = digit* "." digit+ -- fract | digit+ -- whole }
2 * (42 - 1) / 91+2*3oh no( 123 )(2+4)*7