program = { statement } ; statement = if | while | ( expression , ";" ) ; while = "while" , expression , block ; if = "if" , expression , block ; block = "{" , { statement } , "}" ; expression = assignment | declaration ; declaration = "var" , identifier , "=" , expression ; assignment = { identifier , "=" , } logical_and ; logical_and = logical_or { , "||" , logical_or } ; logical_or = equality { , "&&" , equality } ; equality = comparison { , ( "==" | "!=" ) , comparison } ; comparison = term { , ( ">" | "<" | ">=" | "<=" ) , term } ; term = factor { , ( "+" | "-" ) , factor } ; factor = primary { , ( "*" | "/" ) , primary } ; primary = identifier | number | string | group ; group = "(" , expression , ")" ; identifier = alphabetic , { alphabetic | digit } ; string = ( '"' | "'" ) , { character - ( '"' | "'" ) } , ( '"' | "'" ) ; number = digit , { digit } , [ "." , digit , { digit } ] ;