Update ooo320-m1
[ooovba.git] / slideshow / source / engine / arith-grammar.txt
blobb12d320ef3bf80e572a4ec3c11ca3327c59ef85a
1 Based on the C grammar for arithmetic expressions
2 =================================================
4 number_digit = '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'
6 number_exponent = 'e'|'E'
8 basic_number = basic_number number_digit | number_digit
10 number = 
11            basic_number |
13            basic_number number_exponent basic_number |     
14            basic_number number_exponent '-' basic_number |
15            basic_number number_exponent '+' basic_number |
17            '.' basic_number number_exponent basic_number |
18            '.' basic_number number_exponent '-' basic_number |
19            '.' basic_number number_exponent '+' basic_number |
21            basic_number '.' number_exponent basic_number |
22            basic_number '.' number_exponent '-' basic_number |
23            basic_number '.' number_exponent '+' basic_number |
25            basic_number '.' basic_number number_exponent basic_number |
26            basic_number '.' basic_number number_exponent '-' basic_number |
27            basic_number '.' basic_number number_exponent '+' basic_number
30 identifier = '$'|'pi'|'e'|'X'|'Y'|'Width'|'Height'
31               ^            ^   ^     ^       ^
32               |            |   |     |       |
33          '$' in PPT            |   |     |       |
34                          '#ppt_x' in PPT   |     |       |
35                              '#ppt_y' in PPT     |       |
36                                        '#ppt_w' in PPT       |
37                                '#ppt_h' in PPT
39 unary_function = 'abs'|'sqrt'|'sin'|'cos'|'tan'|'atan'|'acos'|'asin'|'exp'|'log'
40 binary_function = 'min'|'max'
43 basic_expression = 
44                                  number |
45                                  identifier | 
46                                  unary_function '(' additive_expression ')' |
47                                  binary_function '(' additive_expression ',' additive_expression ')' |
48                                  '(' additive_expression ')'
50 unary_expression = '-' basic_expression
52 multiplicative_expression = 
53                                                   basic_expression |
54                                                   multiplicative_expression '*' basic_expression |
55                                                   multiplicative_expression '/' basic_expression
57 additive_expression = 
58                                         multiplicative_expression |
59                                         additive_expression '+' multiplicative_expression |
60                                         additive_expression '-' multiplicative_expression