3 ms·
I didn't take a course on compiler construction, and now I don't remember if my university's CS department had one (it was a fairly mediocre CS department at a
by mwcampbell 11y ago
I didn't take a course on compiler construction, and now I don't remember if my university's CS department had one (it was a fairly mediocre CS department at a state university). Now I wish I had.
Do you think a good compiler course would prepare the student to do a project with the scope and complexity of Wasabi? For one project, I wrote an interpreter for a little domain-specific language, then later reworked that interpreter into an on-the-fly compiler (to Lua, to avoid double interpretation). But that's a long way from writing a compiler for a general-purpose language, that can do global type inference and produce human-readable output in a target language that's fairly different from the original VBScript (if not Wasabi itself).
- krallja 11y agoSee https://news.ycombinator.com/item?id=9778928 https://news.ycombinator.com/item?id=9778928 for more. The trickiest bit of Wasabi is the type inference, which I admit is not "production-ready" (or "good code") because we basically invented it from scratch. If I were to do it now, I would know just enough to realize that I need to read about Hindley-Milner rather than reinvent the wheel. Producing human-readable output is an exercise in tedium and bookkeeping, not any particular amount of skill or brilliance.
- mwcampbell 11y agoThanks for confirming my guess that the type inference was the trickiest part. These days, I guess Flow (http://flowtype.org/ http://flowtype.org/) would also be worth studying. Edit: Or PyPy's RPython.