The following is a partial list of C operators: = == != amp;amp;amp;amp; || amp;lt; amp;lt;= amp;gt; amp;gt;= + - * / % -(unary) Write an...



1. The following is a partial list of C operators:

= == != && || < <= > >= + - * / % -(unary)

Write an expression grammar for the above. Ensure correct precedence and associativity. Include support for parenthesis.



2. Using your grammar for the above question, draw parse trees and syntax trees for:

  1. -a + b * (-c - d) / e * f + g

  2. a = b + c * (d + e) * (f - g)

  3. a = b = c = d * (e * (f + g)) + h

  4. a || (b < c) && (d * e) && (-f + g) || h

  5. a || (b < c) && (d > e) && (f != g)



3. Convert the following EBNF into BNF:


A ::= C [B] x

B ::= C (x|y|z) D

C := x {y D}

D := x | y | null