Arc Forumnew | comments | leaders | submitlogin
3 points by Mitranim 3826 days ago | link | parent

I wrote the original compiler in CoffeeScript, then gradually reimplemented its parts in jisp, concurrently fixing bugs and adding features to the remaining coffee parts. The hardest part to replace was the jisp.coffee to jisp.jisp; at that point I had to stop and rearchitect some parts of the old compiler and implement macros in it to write the new one in a relatively sane way. Using a higher-level JavaScript dialect helped in several ways: it allowed to write less code, challenged me to immediately implement those higher-level features, and helped with understanding and debugging JavaScript (which would have been harder if I wrote in a non-JS language).

Didn’t want to publish an unfinished compiler, so there’s no coffee in the repo history. I don’t actually even have a git history before 0.0.1.

Took three weeks from concept to publish. May have been faster or better if I borrowed technical concepts from other implementations, but I wanted the compiler to be completely original. For instance, it converts jisp code into native JavaScript data structures rather than token trees. Not sure how other similar dialects handle this.



1 point by akkartik 3826 days ago | link

Oh that's too bad. I'm intensely curious about the experience and it's very poorly covered in most places. Guess I'll just have to try it for myself :)

-----

2 points by Mitranim 3826 days ago | link

If you mean the experience of implementing a language, what about wart and anarki? Or did you mean something else.

-----

1 point by akkartik 3826 days ago | link

I meant implementing a language in itself.

(Also, I didn't implement anarki. That's more like a maintenance job..)

-----

4 points by Mitranim 3826 days ago | link

Writing a self-hosted compiler feels a bit like climbing a skyscraper without a safety belt. I usually test each change by immediately having the compiler recompile itself a few times. Back when it was unstable, each time felt like a plunge from a mountaintop, with a jolt of adrenaline. I guess it still does. :D

-----