Compiling a Lisp to x86_64 (2020)
bernsteinbear.com
bernsteinbear.com
It's an exceptionally high-quality series, made by HN user tekknolagi: https://news.ycombinator.com/item?id=26627784
(I used to be in the "Clojure is not Lisp" camp, but I've grown up at some point.)
David Miller been doing a tremendous job of keeping it up to date. Latest commit was 2 days ago.
Somehow there's not much overlapping interest there - dotnet folks aren't very much interested in Lisps. Lispers don't care much about dotnet.
Edit: With the JVM version, I've never tried that setup with Clojure CLR.
-▶ time dotnet ./Clojure.Main.dll <<<""
Clojure 1.10.0-beta1
user=> user=>
dotnet ./Clojure.Main.dll <<< "" 16.74s user 0.18s system 99% cpu 16.980 total
Compared to Clojure on JVM: -▶ time clojure -e '(System/exit 0)'
clojure -e '(System/exit 0)' 3.02s user 0.16s system 268% cpu 1.184 total
I wonder, did I do something wrong (I'm not a .NET developer by any stretch) or does it simply take that much time on the CLR?I use Guix System, which lets me use scheme as my configuration, services, and package management language.
I use stumpwm as my window manager
Emacs as my "shell", text editor, word processor, email client, and news reader.
Nyxt as my web browser about 70% of the time.
Its very much a frankenstein, considering I'm using three separate lisps to configure and play with it, but it makes me happy.
How is Nyxt? I've been meaning to try it out. Is it usable for day-to-day tasks? What are the remaining 30% of your use?
As for Guix, I've approached it twice, both times installing (what was then known as) GuixSD. Couldn't really make it work. What are your experiences? And your configuration? :).
Emacs, that I swear by.
Still, what's missing in this picture, and why I mentioned PowerShell, is a typed integration with entire OS. Operating on objects / typed data, invoking functions - instead of passing unstructured blobs of text around. That's what I like about PowerShell approach - my scripts don't invoke CLI utilities, they ask system for objects, inspect them, call into their methods. This is similar to the Lisp Machines, where you could code against objects representing your OS runtime state.
If we could somehow bolt that on top - replace existing Unix tools with ones accepting and producing structured data (or even wrap them) - then the picture would be complete. And I wouldn't mind using four different Lisps, if that's what it takes :).
To make guix system work I had to compile my own proprietary kernel and build an installation image for it. Afterwards I’ve only had minor software and driver issues. I even have steam running now.
So I hear you and through stumpwm I guess I get to work with structured data for window management. It isn’t typed but windows are represented as objects to be manipulated. Thanks to the repl I can change window behavior on the fly and have it reflected immediately.
Guix provides structured ways of manipulating system services and configurations. Most of that stuff has an interface with scheme records.
For instance my sddm configuration is a scheme record that gets tangled (for lack of a better word) into a text file.
With guix one can also use g-expressions to write configurations or execute programs in a monad of some sort.
It isn’t typed but the setup is far from unstructured.
Your explanation helped out greatly.
But I do have two questions, the first of which has literally burned a hole in my brain since I read your tutorial: When you emit the instructions to the buffer, I noticed that you encode the objects(or at least the ints) beforehand. Why is this? I am specifically talking about about line 3 in compile_expr() in part 2. Am I misunderstanding something?
My second question is when you might be releasing a new part in the series ;)
2) Yeah, I know :( I had some life events in fall/winter that stopped all my motion on this series. I have a half-working closure implementation -- the actual closures are fine but the tree transformations are not yet implemented.
I hope your situation has improved/is improving; good luck! I love your website.
(int? foo)
that returns #t or #f depending on if foo is an int. So `int?` needs to have information from somewhere about what type of object it is.
I get more into this in Part 4 (unary primitives).
Thanks :)
And it would be better if both are c?
And I assume you are talking about writing vs compiling a Lisp series? They were written at two different points in my life, and they implement two different languages at this point.