Name : ID : CS315 Programming Languages Section #2 - Quiz #1 Date: Sep 27, 2023 Question: Give the rightmost derivation of the string "B = 4; A = B * 2" in the following grammar. <program> → <stmts> <stmts> → <stmt> | <stmt> ; <stmts> <stmt> → <var> = <expr> <var> → A | B | C <expr> → <term> * <term> | <term> / <term> | <const> <term> → <var> | <const> <const> → 1 | 2 | 3 | 4 | 5 Answer: <program> ⇒ <stmts> ⇒ <stmt> ; <stmts> ⇒ <stmt> ; <stmt> ⇒ <stmt> ; <var> = <expr> ⇒ <stmt> ; <var> = <term> + <term> ⇒ <stmt> ; <var> = <term> * <const> ⇒ <stmt> ; <var> = <term> * 2 ⇒ <stmt> ; <var> = <var> * 2 ⇒ <stmt> ; <var> = B * 2 ⇒ <stmt> ; A = B * 2 ⇒ <var> = <expr> ; A = B * 2 ⇒ <var> = <const> ; A = B * 2 ⇒ <var> = 4; A = B * 2 ⇒ B = 4; A = B * 2