4 ms·
Macro-Lisp, a Lisp-Like DSL for Rust Language
- alekratz 9y agoHah, I thought about doing this at some point. I think it's cool that someone put the effort into it, Rust's macros are conducive for this sort of thing.
- piemonkey 9y agoRust macros are extremely impressive. This reminds me of Will Crichton's Lia library[0], which embeds a convenient matrix manipulation domain specific language inside of Rust. This seems like a very promising direction for fusing the low-level performance of Rust with the high-level readability and usability of a managed language. Exciting times. [0]:https://github.com/willcrichton/lia https://github.com/willcrichton/lia
- sbensu 9y agoFrom this project, I gather it wouldn't be hard to remove the need for calling `lisp!` on every form. Then you'd have a lisp syntax on Rust that is not embedded. Is that correct?
- steveklabnik 9y agoIt would be impossible to remove the `lisp!` on every form, as you have to actually invoke the macro. You could make a build script that would read in lisp files, and then run them through a pre-processor of sorts before compiling. That's the closest thing, and it'd still require setting up that build.rs.
- kazinator 9y ago> You could make a build script that would read in lisp files, and then run them through a pre-processor of sorts before compiling. At that point, you would be better off using a Lisp implementation and its expander over a bunch of Lisp to Rust macros.
- steveklabnik 9y agoSure. I don't suggest that this is a good idea, just that it'd be possible this way.
- aidenn0 9y agoJust look at the progn expansion and create one like it that doesn't add the curly braces, and that ought to work I think; (perhaps call it "prog" or something).
- didibus 9y agoThis reminds me a little bit of rebol, and the concept of dialecting. So the language is composed of many DSLs called dialects each specialized for different things.
- pflanze 9y agoInteresting, I'm planning to implement a translator from a subset of Scheme to Rust. The source code will be Scheme plus extraneous forms for declaring types and borrow checker information / referencing, minus support for call/cc and other difficult to translate Scheme features. I want to develop a program in a Scheme interpreter then be able to compile it as a Rust program. Contact me if interested (and meet me in London via http://rustaceans.uk http://rustaceans.uk).
- yogthos 9y agoImagine if Rust just used s-expressions as syntax in the first place.
- jhgb 9y agoYou'd get something quite similar to Chez Scheme, presumably. (Without the battle-proven heritage, of course.)
- kaoD 9y agoSimilar in what way?
- agumonkey 9y agoI wonder if rust revived some interest in linear lisp.
- mark_edward 9y agoi tried to implement this ~7 years ago when i'd just learned programming and had also just heard about rust. did not go well
- rapsey 9y agoRust macro based language. All great until you have to debug or figure out why it does not compile. Then you may just as well kill yourself.
- DDSDev 9y agoWhile not ideal, one tool for this situation is "cargo expand". It will expand your macros so that you can examine what code is being generated, and hunt down what might be happening.
- jnordwick 9y agoVery cool! Is this meant for actual use, and why would anybody use it?