Question

The grammar below generates Boolean expressions in prefix notation: B → O B B | not...

The grammar below generates Boolean expressions in prefix notation:

B → O B B | not B | id O → and | or

a) Write an attribute grammar to translate Boolean expressions into fully parenthesized infix form. For example, expression and and a or b c d turns into the following fully parenthesized expression ((a and (b or c)) and d).

b) Now write an attribute grammar to translate the Boolean expressions into parenthesized expressions in infix form without redundant parentheses. Use the established convention that not has highest precedence, followed by and, followed by or, and and and or are left-associative. For example, the above expression turns into a and (b or c) and d.

Homework Answers

Answer #1

answered for second part...plz don't dislike I requests to all of u..

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions