PLQ #2Done on:   Tuesday, January 21st

Question 1 @ 2025-01-21 18:44

The purpose of a BNF (Backus-Naur Form) is to specify:


Question 2 @ 2025-01-21 18:48

Does it make sense to talk about a BNF for BNFs?

(Reminder: choose the best answer.)


Question 3 @ 2025-01-21 18:51

Which of the following BNF grammars are ambiguous?


Question 4 @ 2025-01-21 18:54

As you work on a BNF for a simple language, your friend looks over your shoulder and sees the grammar that you wrote:

<AE>  ::= ... <PROD> ...
<PROD> ::= ... <ATOM> ...
<ATOM> ::= <num>
        | ( <AE> )
        | [ <AE> ]
        | { <AE> }

“Why not abstract the parens to make it shorter?” — suggesting this change:

<ATOM>  ::= <num>
          | <OPEN> <AE> <CLOSE>

<OPEN>  ::= ( | [ | {
<CLOSE> ::= ) | ] | }

Does this specify the same language?


Question 5 @ 2025-01-21 18:57

Generally speaking, what did we mean by the term “compositional”?