1*cdf0e10cSrcweirBased on the C grammar for arithmetic expressions 2*cdf0e10cSrcweir================================================= 3*cdf0e10cSrcweir 4*cdf0e10cSrcweirnumber_digit = '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9' 5*cdf0e10cSrcweir 6*cdf0e10cSrcweirnumber_exponent = 'e'|'E' 7*cdf0e10cSrcweir 8*cdf0e10cSrcweirbasic_number = basic_number number_digit | number_digit 9*cdf0e10cSrcweir 10*cdf0e10cSrcweirnumber = 11*cdf0e10cSrcweir basic_number | 12*cdf0e10cSrcweir 13*cdf0e10cSrcweir basic_number number_exponent basic_number | 14*cdf0e10cSrcweir basic_number number_exponent '-' basic_number | 15*cdf0e10cSrcweir basic_number number_exponent '+' basic_number | 16*cdf0e10cSrcweir 17*cdf0e10cSrcweir '.' basic_number number_exponent basic_number | 18*cdf0e10cSrcweir '.' basic_number number_exponent '-' basic_number | 19*cdf0e10cSrcweir '.' basic_number number_exponent '+' basic_number | 20*cdf0e10cSrcweir 21*cdf0e10cSrcweir basic_number '.' number_exponent basic_number | 22*cdf0e10cSrcweir basic_number '.' number_exponent '-' basic_number | 23*cdf0e10cSrcweir basic_number '.' number_exponent '+' basic_number | 24*cdf0e10cSrcweir 25*cdf0e10cSrcweir basic_number '.' basic_number number_exponent basic_number | 26*cdf0e10cSrcweir basic_number '.' basic_number number_exponent '-' basic_number | 27*cdf0e10cSrcweir basic_number '.' basic_number number_exponent '+' basic_number 28*cdf0e10cSrcweir 29*cdf0e10cSrcweir 30*cdf0e10cSrcweiridentifier = '$'|'pi'|'e'|'X'|'Y'|'Width'|'Height' 31*cdf0e10cSrcweir ^ ^ ^ ^ ^ 32*cdf0e10cSrcweir | | | | | 33*cdf0e10cSrcweir '$' in PPT | | | | 34*cdf0e10cSrcweir '#ppt_x' in PPT | | | 35*cdf0e10cSrcweir '#ppt_y' in PPT | | 36*cdf0e10cSrcweir '#ppt_w' in PPT | 37*cdf0e10cSrcweir '#ppt_h' in PPT 38*cdf0e10cSrcweir 39*cdf0e10cSrcweirunary_function = 'abs'|'sqrt'|'sin'|'cos'|'tan'|'atan'|'acos'|'asin'|'exp'|'log' 40*cdf0e10cSrcweirbinary_function = 'min'|'max' 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir 43*cdf0e10cSrcweirbasic_expression = 44*cdf0e10cSrcweir number | 45*cdf0e10cSrcweir identifier | 46*cdf0e10cSrcweir unary_function '(' additive_expression ')' | 47*cdf0e10cSrcweir binary_function '(' additive_expression ',' additive_expression ')' | 48*cdf0e10cSrcweir '(' additive_expression ')' 49*cdf0e10cSrcweir 50*cdf0e10cSrcweirunary_expression = '-' basic_expression 51*cdf0e10cSrcweir 52*cdf0e10cSrcweirmultiplicative_expression = 53*cdf0e10cSrcweir basic_expression | 54*cdf0e10cSrcweir multiplicative_expression '*' basic_expression | 55*cdf0e10cSrcweir multiplicative_expression '/' basic_expression 56*cdf0e10cSrcweir 57*cdf0e10cSrcweiradditive_expression = 58*cdf0e10cSrcweir multiplicative_expression | 59*cdf0e10cSrcweir additive_expression '+' multiplicative_expression | 60*cdf0e10cSrcweir additive_expression '-' multiplicative_expression 61*cdf0e10cSrcweir 62