Simon has studied Context-Free Grammar, following a set of tutorials from Daniel Shiffman’s ITP course “Programming from A to Z“. Context-Free Grammar is a set of recursive “replacement” rules to define the syntax of a language and to generate text: “Programming languages, for example, are context-free grammars — a compiler reads your code to make sure it conforms to specific rules and informs you of any errors. A context-free grammar, however, isn’t robust enough to describe the complexities of natural language. After all, they have no context! Natural languages can be described using Context-sensitive grammars, a concept introduced by Noam Chomsky in the 1950s”.
Every time he hit a key, the values of the variables in his story changed:
The following day Simon programmed another grammar to generate haiku’s: