3 ms·
I’ve written a library as well as a toy compiler in Rhombus. I occasionally work with Matthew Flatt. I’m happy to try to answer any questions! :) One of the bi
by ashton314 2y ago
I’ve written a library as well as a toy compiler in Rhombus. I occasionally work with Matthew Flatt. I’m happy to try to answer any questions! :)
One of the biggest things that make Rhombus an interesting language is its “shrubbery” notation. In languages with macros, you typically get faced with a trade-off: if you want to operate on an AST, then the syntax going into the macro needs to be parsable by the host language, thus limiting what kind of syntax you can have in a macro. On the other hand, you can pass a token stream, which gives you a lot more flexibility; the problem now is that you need some parser to recover binding syntax when you want it, which complicates things.
Rhombus does a little bit of parsing, but leaves subterms unparsed until later. This gives you flexibility in your macro syntax without the complications of using a raw token stream.
There’s a lot of other interesting stuff like its ability to bind macros in different spaces (a macro can have one expansion when used on the left of an assignment and a different one in expression position), the ability to attach static information to identifiers at compile time and have that propagate to use sites, etc.
Here’s my compiler: https://codeberg.org/ashton314/rhombus-compiler https://codeberg.org/ashton314/rhombus-compiler
Here’s the library: https://github.com/ashton314/rhombus_dyn https://github.com/ashton314/rhombus_dyn
Motivation for building the library: https://lambdaland.org/posts/2024-07-15_type_tailoring/ https://lambdaland.org/posts/2024-07-15_type_tailoring/