Semantic actions for calculation
Pre-release
Pre-release
- Add semantic actions to the grammar
- The terminal symbol for literal number and the non terminal symbols receives a semantic value of type Double, corresponding to their value when evaluated.
- The semantic actions evaluate the operations indicated in each production rule, calculating the semantic value of the symbol in its left hand side.
- At the end the start symbol semantic value is the value of the whole expression.