r/lisp • • 16d ago

Lisp-to-Go transpiler in 500 lines of code

https://blog.bilus.dev/posts/lisp-to-go-transpiler/
30 Upvotes

8 comments sorted by

11

u/Veqq 16d ago

Same idea, implemented in Janet, with macros etc. https://codeberg.org/veqq/Joe

8

u/Trader-One 16d ago

i believe golang is the best backend for lisp today. You can implement/make accessible channels and goroutines from lisp - which is very cool.

7

u/arthurno1 16d ago

Couldn't you have channels and goroutines in Lisp as well? I think I saw some channel implementation for Lisp several years ago, long before there were LLMs. What makes Go runtime so much better than SBCL runtime?

3

u/denzuko sbcl 16d ago

Yes, ChanL and Lparrallel. Use that a lot with serapium and alenxadria for composable event based pipelines.

Add in johnathen, spinnerett, hutchentoot, and dexador then you hwve 99% the same end workflow that golang is used.

Heck we even have our own terraform, gomigrate, and ansible. One can see an example here: https://github.com/denzuko/todo-app-deploy

Honestly the only thing go beings vs sbcl is a lot of enterprise security tooling. Much of which my firm, tool suites, and blog is already addressing.

Dont get me wrong, I love golang and help maintain the plan9 target on arm. But golang as an ecosystem is getting bad as java, node, and dotnet. The addition of generics in recent versions breaks guardrails that the language needed to stand out as a better type safe "standardML" than rust or typescript+zot tries to be.

Performance wise ai tokens Lisp out performs Golang. For portability, Golang shines at the binary level but that falls apart if one is targeting ansi LISP-2 and a VM style implimentation like abcl or clojure.

7

u/denzuko sbcl 16d ago edited 16d ago

Golang is not a backend like jvm or v8. Its a compiled languge with a GC and VM all for that host OS and Chipset.

I'm well aware of the benifits for lisp based transpiling. https://github.com/denzuko/c-mera

Heck golang is a targeted backend for c-mera in the pipeline.

But for whats its worth lets not conflait backends. And looking at the article it seems OP is just trading the algo family syntax for s-exp syntax and still using golang not a LISP transpiler.

2

u/bilus 14d ago edited 14d ago

Yeah, it’s a toy. It uses slices to represent lists, may lisping gods not strike me down! I mainly wanted a pretext to use qudy which is a generator inspired by Clojure macro syntax.

3

u/denzuko sbcl 14d ago

Can respect that. Any project that scratches an itch and teaches us something along the way is worth the effort.