Sexp support as rust macro

  1. I am aware of Ketos. I am not looking for a lisp interpreter.

  2. One of my favourite features of Lisp is “code as data; data as code.” This is a bit harder to do in Rust.

  3. Is there some Rust macro that lets me write some expressions in sexp notation? There are certain data/patterns/DSLs I find easier to express in sexp instead of Rust notation.

There are a few crates on crates.io that could help

https://crates.io/search?q=sexp

I clicked on every crate on the first page (is there more?).

Every crate seems to be a parser.

I must have mis stated my problem – I want to do this at compile time, via macros.

In particular, doing the ‘translation’ at compile time lets me get all the benefits of Rust’s compiler / type checker,

whereas if we do it at run time, either:

  1. everything is sexp/value OR
  2. we need to write our own type checker

Oh, sorry my fault i misunderstood. This blog goes over how to write a macro for reverse polish notation, which is similar if not the same as sexp.