rlisp
Hello, Hacker News. You're not wrong. This is a weekend project, not a production compiler — some Rust syntax is missing (turbofish is fixed now, lifetime bounds are on the list). The point isn't completeness; it's exploring what happens when you bolt Lisp macros onto Rust semantics. If that sounds interesting, read on. If you're looking for something to be mad about, the issue tracker is open.
Rust semantics with LISP syntax. A transparent s-expression frontend that compiles directly to Rust — no runtime, no GC, just (s-expr → .rs → binary) .
(struct Point (x f64) (y f64)) (impl Point (fn distance (( &self ) (other &Point )) f64 ( let dx ( - ( . self x) ( . other x))) ( let dy ( - ( . self y) ( . other y))) (( . dx powf 2.0 ) + ( . dy powf 2.0 )) sqrt )) (fn main () () ( let p1 (new Point (x 0.0 ) (y 0.0 ))) ( let p2 (new Point (x 3.0 ) (y 4.0 ))) (println! " Distance: {} " ( . p1 distance (& p2))))
Everything Rust has — ownership, borrowing, lifetimes, generics, traits, pattern matching — expressed as s-expressions. No semantic gap. rustc does type checking, borrow checking, and optimization. rlisp just handles the syntax.
Install
git clone https://github.com/ThatXliner/rlisp.git cd rlisp cargo install --path .
Usage
rlisp compile file.lisp # transpile to file.rs rlisp build file.lisp # transpile and compile with rustc rlisp run file.lisp # transpile, compile, and run
Syntax map
... continue reading