(* Грамматика арифметического калькулятора *) expression = term , { ( "+" | "-" ) , term } ; term = factor , { ( "*" | "/" ) , factor } ; factor = [ "-" ] , ( primary | function ) ; function = ( "sin" | "cos" ) , "(" , expression , ")" ; primary = number | "(" , expression , ")" ; number = digit , { digit } , [ "." , digit , { digit } ] ; digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;