Question: Please help with parts 1-6! For this homework, you will write BNF grammars for some types of expressions and statements. You do not need to

Please help with parts 1-6!

Please help with parts 1-6! For this homework, you will write BNF

grammars for some types of expressions and statements. You do not need

to resolve ambiguity such as operator precedence or associativity. Your grammars do

not consider white spaces. For example, the following grammar defines arithmetic expressions

For this homework, you will write BNF grammars for some types of expressions and statements. You do not need to resolve ambiguity such as operator precedence or associativity. Your grammars do not consider white spaces. For example, the following grammar defines arithmetic expressions with the non-terminal denotes the binary arithmetic operators. You should quote all tokens like this example. This grammar accepts expressions such as: (ab)/c((a5)/c+1)22(x+3)y+z/a244+b 1. Using regular expressions, define the non-terminal num that represents numbers and define the non-terminal var that represents variables. 2. Define the non-terminal that represents binary boolean operators \& and . 3. Define the non-terminal that represents binary comparison operators =,> 4. Define the non-terminal that represents logical expressions (i.e. boolean expressions). The grammar should accept expressions such as: !(a/20 Note that logical expressions include negation operator ! and the hoolean constant true and false. You should utilize the non-terminals bop,cop. 5. Draw an abstract syntax tree for !(a+20 6. Define the non-terminal \&Stmts> that represents zero or more statements, where each statement is either an assignment, a while-loop, or an if-statement (with optional else-part.) Here is program that can be represented by the non-terminal . b= true; y=2; while (!b&k

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!