-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrammar.txt
More file actions
30 lines (20 loc) · 1.22 KB
/
grammar.txt
File metadata and controls
30 lines (20 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<math_expression> ::= <mult/div_expression> <sum/substract_list>
<sum/substract_list> ::= + <mult/div_expression> <sum/substract_list>
| - <mult/div_expression> <sum/substract_list>
| ε
<mult/div_expression> ::= <unary_expression> <mult/div_list>
<mult/div_list> ::= * <unary_expression> <mult/div_list>
| / <unary_expression> <mult/div_list>
| ε
<unary_expression> ::= + <unary_expression>
| - <unary_expression>
| <pow_expression>
<pow_expression> ::= <par/function_expression> <pow_list>
<pow_list> ::= ^ <unary_expression> <pow_list>
| ε
<par/function_expression> ::= <trigonometric_function> ( <math_expression> )
| ( <math_expression> )
| IDENTIFIER.val // value has to be entered by the user
| NUMBER // it can be FLOAT or DOUBLE or INT
<trigonometric_function> ::= COS | SIN | TAN | SEN // SEN is also on the list because this project was designed to read mathematical expressions entered
// in Spanish or English