Question 1 @ 2023-01-24 18:55
What’s the problem with this BNF:
<PAGES> ::= <int>
| <int> - <int>
| <int> , <PAGES>
| <int> - <int> , <PAGES>
- There is no problem.
- It’s ambiguous.
- It has an infinte loop so it’s undecidable.
- It repeats a sub-pattern, so could be written in a better way.
- It does not enforce normalized sets of pages.
Question 2 @ 2023-01-24 19:00
What is the reason we’re using BNFs to specify our language(s)?
- They’re a common simple way of specifying grammars.
- They’re easier to implement compilers for.
- They enforce compositional evaluation, so they simplify the language.
- They turned out to be useful representations, as seen by the history
of S-expressions in Lisp.
- No real reason.
Question 3 @ 2023-01-24 19:03
The AE BNF is:
<AE> ::= <num>
| { + <AE> <AE> }
| { - <AE> <AE> }
| { * <AE> <AE> }
| { / <AE> <AE> }
Is this for a language that evaluates expressions left-to-right or
right-to-left?
- It is LtR
- It is RtL
- It’s non-deterministic
- Order is unrelated
- Depends on the calling compiler