January 2020
Intermediate to advanced
532 pages
13h 31m
English
Recall from the previous section that we want to have a clean syntax for defining an L-System model. From a metaprogramming perspective, we just need to translate the code from one abstract syntax tree to another. The following diagram shows graphically what kind of translation is required:

It turns out that the translation is quite straightforward. When we encounter an axiom, we translate the code to construct a new LModel object. When we encounter a rule, we translate the code to an add_rule! function call.
While it seems easy enough, this kind of source-to-source translation can be greatly simplified using ...
Read now
Unlock full access