Rewrite the following example (BNF) to give + precedence over * and also force +
ID: 3665116 • Letter: R
Question
Rewrite the following example (BNF) to give + precedence over * and also force + to be right associative.
<assign> --> <id> = <expr>
<id> --> A | B | C
<expr> --> <expr> + <term>
| <term>
<term> --> <term> * <factor>
| <factor>
<factor> --> ( <expr> )
| <id>
Explanation / Answer
solution is: --> = --> A | B | C --> * | ***//applying the + precedence here over * //*** --> + **//apply + to be right associative over this //*** | --> ( ) |Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.