PLQ #1Done on:   Tuesday, January 26th

Question 1 @ 2021-01-26 18:14

How many tangents should I do today?

  1. 0%
  2. 10%
  3. 20%
  4. 30%
  5. 40%
  6. 50%
  7. 60%
  8. 70%
  9. 80%
  10. 90%
  11. 100%

Question 2 @ 2021-01-26 20:09

Your friend looked over your shoulder, and saw our AE grammar

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

and came up with a bright idea: why not “abstract” away the parens to make this shorter? Here’s the suggested alternative:

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

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

Does this preserve the language?

  1. Yes.
  2. Yes, and it even hints at a better parser implementation.
  3. No.
  4. No: in this variant parens might not be balanced, eg: “(1 + 2)))”
  5. No: in this variant paren shapes can be different, eg: “[1 + 2)”

Question 3 @ 2021-01-26 20:09

What is the reason we’re using BNFs to specify our language(s)?

  1. They’re a common simple way of specifying grammars.

  2. They’re easier to implement compilers for.

  3. They’re inherently compositional so they simplify the semantics.

  4. They turned out to be useful representations, as seen by the history of S-expressions in Lisp.

  5. No real reason.