Question 1 @ 2024-01-23 18:17
Did you know that you can suggest PLQ questions?
-
What’s a “PLQ”?
-
I had no idea.
-
Wait, that was serious?? I thought it was a joke.
-
I know that, but hookairs.
-
I know that, but I don’t want to.
-
I know that, but I’m afraid to write bad questions.
-
I know that, and plan to do so in the future.
-
(Or write anything, if none of the above.)
Question 2 @ 2024-01-23 18:19
Which of the following BNF grammars are ambiguous?
(Multiple choice!)
-
<AE> = <num> | <AE> + <AE> | <AE> * <AE>
-
<AE> = <num> | ( <AE> + <AE> ) | ( <AE> * <AE> )
-
<AE> = <MUL> + <MUL>
<MUL> = <num> | <num> * <MUL> -
<AE> = <num> | <ADD> | <MUL>
<ADD> = <AE> + <AE>
<MUL> = <AE> * <AE>
Question 3 @ 2024-01-23 18:23
What is the reason we’re choosing BNFs to specify our language(s)?
-
They’re a commonly known simple way of specifying grammars.
-
They’re easier to implement compilers for.
-
They’re easier to implement interpreters for.
-
They make it easy to avoid non-deterministic syntax.
-
They turned out to be useful representations, as seen by the history of S-expressions in Lisp.
-
No reason.
Question 4 @ 2024-01-23 18:26
Generally speaking, what did we mean by the term “compositional”?
-
Making frequent use of function composition, meaning a heavy focus on functional programming.
-
The meaning of something depends only on the meaning of its sub-parts and nothing else.
-
Sticking to a modular implementation of languages, so we can easily change various parts of the code.
-
Same as using “combinatorial”, which cannot be used since it’s often associated with discrete math.
-
Nothing special.
Question 5 @ 2024-01-23 18:27
Tail-call elimination optimizes code in which of the following ways?
(Reminder: choose the best answer!)
-
Improves the semantics by making it simpler
-
Improves time complexity (runtime)
-
Improves space complexity (space)
-
Improves style by being more idiomatic Racket
-
Allows compiling recursive loops into efficient machine code