Question: ::= + | ::= * | ::= ( ) | a | b | c (a) Add subtraction and division to the language. Subtraction has

::= + |

::= * |

::= () | a | b | c

(a) Add subtraction and division to the language. Subtraction has the same precedence as addition, and division has the same precedence as multiplication. You may change names of non-terminals, but make sure everything is reasonable and clear. Both subtraction and division are left-associative. Use - to indicate subtraction and / to indicate division.

(b) This language also has boolean expressions. Boolean expressions can either be true or false , or they can be made up of two expressions combined with a comparison operator (>, <, <=, >=, !=, or ==), or they can be made up of a combination of two boolean expressions using the boolean operators (!, &&, ||), or they can be a boolean expression in parentheses. The comparison operators all have the same precedence, but the boolean operators have the following precedence order:

1. parentheses

2. !

3. &&

4. ||.

Boolean operators are also left associative, and comparison operators are evaluated before boolean operators. There are also three variables designated for boolean expressions: x, y, and z. Add grammar rules for boolean expressions ( ). Note: these operators should all work the same as they do in Java, given the limitations of this language

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!