First chapters of BR are quite simple but introduce you to several techniques that end up being used in the latest 3 chapters where you implement a BASIC itnerpreter/compiler.
What happens in some chapters is that the translation is just a syntactic one, and it feels like just doing the parsing (which is cool btw) but you can’t really implement behaviors that aren’t equal at the semantic level on Racket.
Those DSLs use global variables, so there’s an “easy way”, in
racket: define
in the toplevel. The question is, what if I’d like
to implement something that doesn’t have a direct mapping[fn:1] to
the underneath Racket features? Nice thing is that Racket has a
shiton of features so it probably won’t happen for the first 700
Programming Languages you’re gonna write, but the question still
remains. Did I learn how to do everything? (without going into
computability academic discussions)
- https://news.ycombinator.com/item?id=16454854 is a HN thread with interesting comments on that respect. Some rise the same concerns about semantic similarities between the DSL and runtime.
- Henry G. Baker - Pragmatic Parsing in Common Lisp is a paper possibly relevant to the exercise of translating the BR effort to Common Lisp.
[fn:1] Recently I skimmed over a couple of articles on convivality( http://akkartik.name/akkartik-convivial-20200315.pdf, https://www.cs.kent.ac.uk/people/staff/srk21/research/talks/kell19software-slides.pdf) . And ended up in this Gregor Kiczales presentation.[fn:2]
[fn:2] Yay footnotes!