
Macro-Lisp, a Lisp-Like DSL for Rust Language - DDSDev
https://github.com/JunSuzukiJapan/macro-lisp
======
piemonkey
Rust 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)

------
pflanze
Interesting, 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)).

------
didibus
This 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.

------
rapsey
Rust 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
While 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.

------
yogthos
Imagine if Rust just used s-expressions as syntax in the first place.

~~~
jhgb
You'd get something quite similar to Chez Scheme, presumably. (Without the
battle-proven heritage, of course.)

~~~
kaoD
Similar in what way?

------
sbensu
From 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
It 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
> _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
Sure. I don't suggest that this is a _good_ idea, just that it'd be possible
this way.

------
jnordwick
Very cool! Is this meant for actual use, and why would anybody use it?

------
alekratz
Hah, 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.

