I am adding Crystal to Compiler Explorer

I have opened a pull request to Compiler Explorer for Crystal from 1.0 down to 0.29. Take a look and try it out locally if you can. Some notes:

  • Compiling anything in release mode with the default prelude will most certainly timeout.
  • Even an empty file produces ~190k lines of assembly, but the filters should bring it down to ~13k. On a local instance this is fine (“Reveal linked code” / Ctrl+F10 should work), but they might not like it on their servers.
  • I have deliberately not used the Monaco language for Ruby because there are too many dissimilarities between Crystal and Ruby syntax (the Crystal online playground is one such example why we shouldn’t). Further contributions to the language rules are welcome.
  • You could point to a local Crystal installation different from the default /usr/bin/crystal by modifying the file etc/config/crystal.defaults.properties.
  • Adding nightly builds is beyond my expertise. It seems to require a separate Docker image.
11 Likes

Crystal support is now live: Compiler Explorer

12 Likes

That’s awesome! Great work on that. It’s interesting that the default example is a method defined using fun. I guess I’ve just never thought about writing a method like that except in the C libs :joy: It looks like it generates a few extra lines than using def (though, I don’t really understand what it’s saying lol)

There was a discussion about that on the PR.

With a def the method needs to be invoked in order to codegen - looks as the this provides a good way to inspect a minimal example with little other noise.

Incredible work @HertzDevil!

3 Likes