2 ms·
So if CoffeeScript is written in CoffeeScript, does that mean that the developer had to compile it by hand the first time and is now using each version to compi
by simonw 17y ago
So if CoffeeScript is written in CoffeeScript, does that mean that the developer had to compile it by hand the first time and is now using each version to compile the next version?
- barrkel 17y agoNormally nowadays you would write two compilers: one for a subset of the language in a different but ideally similar language, and a second compiler in the subset that hopefully is a fairly straightforward translation of the first compiler. After the second compiler is able to compile itself, you're bootstrapped.
- jashkenas 17y agoThe original compiler was written in Ruby, and CoffeeScript started out life as a Ruby gem. Once the language reached a reasonable stage of completion, we ported it over to CoffeeScript and axed the Ruby version. Now, every time that you run "bin/cake build", you re-write your entire compiler. It's pretty fun stuff -- if you're working on the language and you break something, guess what, you no longer have a working compiler to dig yourself out with. So the usual pattern for language work (bin/cake build:full), is to check out the "lib" directory (in case you broke it), rebuild the compiler twice, to get your modifications built-in, and then to run all of the tests.
- Groxx 17y agoThough I appreciate the code, and will definitely read through it, and I like the idea of a self-compiled language... that seems like more hassle than it's worth (very specifically the double-compilation / failed => super.fail part. A compiler in the language it compiles has advantages for the programmers using it, among other things).