
ChrysaLisp – A 64-bit Lisp OS with GUI - bespoke_engnr
https://github.com/vygr/ChrysaLisp
======
bespoke_engnr
I just saw this come up in an arpilisp discussion thread
([https://github.com/marcpaq/arpilisp](https://github.com/marcpaq/arpilisp)).

ChrysaLisp is an Assembler/C-Script/Lisp 64 bit OS. MIMD, multi CPU, multi
threaded, multi core, multi user, and will build from source in ~2 seconds on
most OS X or x64 Linux desktops.

Maybe this will let me live vicariously through someone who has actually
_built_ the project I always dream of creating in my free time.

~~~
tejaswiy
I started on this path, got through the boot-up, interrupts etc. and to a
simple shell. Once that was done, instead of targeting something simpler like
malloc(), I wanted to get a VGA driver working. VGA drivers are notoriously
hard and I _really_ wanted my OS to have a UI so after a couple of weeks of
studying and getting nowhere, I gave up on the whole project.

I think the one major thing that caused me to give up on the project was
whenever it became time to refactor or to think about the big picture (for ex.
where do the drivers live? what about a libc implementation - can you just get
glibc to work on your OS? Or do you have to rewrite the whole of libc?), I
found that I was just copying whatever linux had already done. The feeling
that I wasn't really doing any original work and am making a shittier version
of an existing system demotivated me for some reason even though this was just
supposed to be a learning exercise. So some advice for anyone attempting this
- be prepared to go out of your way to rewrite significant amounts of helper
code that has nothing to do with actually building your OS.

~~~
kryptiskt
For a libc on a weird OS I would recommend newlib
([https://sourceware.org/newlib/](https://sourceware.org/newlib/)), which is a
libc for embedded systems and so has a well-defined way to implement the basic
stuff that it needs to run.

------
bluefox
A bit of a stretch to call this a "Lisp OS" yet. If you look at the project's
history, you can see that it was written in nasm, and at some point the author
"slapped some parens around" and took steps to make it into an actual Lisp
dialect, but it's not there yet, as it lacks many of the features you'd expect
from a Lisp. Also see README_LISP.md.

------
tyingq
Does this roughly offer the same benefits that the old lisp machines provided?

I've never used one, but have heard people rave about how productive they were
on them.

~~~
lisper
No.

I expect this will be a fairly controversial comment, so I want to preface
this by saying that I'm a big Lisp fan (just look at my handle). Lisp is my
favorite programming language. I've been using it for nearly forty years. My
first Lisp was P-Lisp on an Apple II in 1980. And I worked on Symbolics Lisp
machines in the 1990s. They were very cool, but there's a reason they failed:
general-purpose computing is infrastructure, and the economics of
infrastructure are such that having a single standard is the most economical
solution, even if that standard is sub-optimal. For better or worse, the
standard for general-purpose computing is the C machine.

Because it's general-purpose you certainly _can_ run Lisp on a C machine (just
as you could run C on a Lisp machine). You can even do this at the system
level. But Lisp will always be at a disadvantage because the hardware is
optimized for C. Because of this, C will always win at the system level
because at that level performance matters.

But that in and of itself is not the determining factor. The determining
factor is the _infrastructure_ that has grown up around the C machine in the
last few decades. There is an enormous amount of work that has gone into
building compilers, network stacks, data interchange formats, libraries, etc.
etc. and they are all optimized for C. For Lisp to be competitive at the
system level, nearly all of this infrastructure would have to be re-created,
and that is not going to happen. Even with the enormous productivity
advantages that Lisp has over C (and they really are enormous) this is not
enough to overcome the economic advantages that C has by virtue of being the
entrenched standard.

The way Lisp can still win in today's world is not by trying to replace C on
the system level, but by "embracing and extending" C at the application level.
I use Clozure Common Lisp. It has an Objective-C bridge, so I can call ObjC
functions as if they were Lisp functions. There is no reason for me to know or
care that these functions are actually written in C (except insofar as I have
to be a little bit careful about memory management when I call C functions
from Lisp) and so using Lisp in this way still gives me a huge lever that is
economically viable even in today's world. I have web servers in production
running in CCL on Linux, and it's a huge win. I can spin up a new web app on
AWS in just a few minutes from a standing start. It's a Lisp machine, but at
the _application_ level, not the system level. My kernel (Linux) and web front
end (nginx) are written in C, but that doesn't impact me at all because they
are written _by someone else_. I just treat them as black boxes.

I don't want to denigrate ChrysaLisp in any way. It's tremendously cool. But
cool is not enough to win in the real world.

[UPDATE] ChrysaLisp is actually doing the Right Thing with respect to its GUI
by using a C-library (SDL). But it's trying to re-invent the compiler wheel
(and the language design wheel) so that it can run on bare metal and "grow up
to be a real Lisp machine" some day, and I think that aspect of the project is
a fool's errand. There are already many Lisps that can run on bare metal (ECL
was specifically designed for that). None of them have succeeding in
displacing C, and I believe none ever will because the economic hurdles are
insurmountable.

~~~
gumby
Yes, but...

I basically agree with everything you wrote, but for two subsidiary points.

1 - it's a phenomenal development platform. I have on multiple occasions built
large systems later deployed, for the reasons you discussed, via C ports. It
didn't nullify the work done in Lisp: we learned a lot, and quickly; were able
to do quick experiments, etc. But ultimately we needed to join the wider
world.

2 - there is / has been a sea change in the software deployment model; it
includes web browsers, even more rapid and more flexible development etc.
Clojure is a good example and consequence of this change. It's quite possible
that the circumstances that led to Lisps decline (though was it really ever
"mainstream?") may swing the tide the other way. E.g. "Rapid development and
realtime deployment of lisp-based microservices" to agglomerate some popular
buzzwords.

FWIW: I was a developer from MACLISP to MIT CADRS, various Symbolics machines
(at one point I had _two_ 36xx machines on my desk _with color monitors
attached_ ) and various D machines. Right now I'm doing my development in C++
though.

~~~
exikyut
Googling "d machine" gave (semi-)predictably nonsense results. And _Wikipedia
does not have an article with this exact name._

What was this?

~~~
lispm
Machines from Xerox running Interlisp-D. The computers had acronyms starting
with D. Xerox later also integrated Common Lisp into Interlisp-D.

The hardware was not powerful - for example they had very little RAM.

But an emulator was developed for SPARC/UNIX and X86/Linux. Called Medley.

------
gavanwoolery
One can debate whether or not this is a "true" operating system, but I'd like
to coin a (new?) term: "virtual operating system"...not to be confused with
emulation or virtual machines, but rather an OS that runs on top of a host OS.
One obvious use for such a thing is reskinning an underlying operating system
in a non-trivial way, i.e. completely changing the UI paradigms. Another use
is allowing programmatic access to virtually everything.

~~~
Sir_Cmpwn
I would just call this a shell or a runtime environment. It's not an OS and I
don't think we should co-opt that term. We don't call nurses virtual surgeons
or construction workers virtual architects.

~~~
gavanwoolery
I agree there is probably a better term, but the differentiation would be that
you are abstracted one level up from a native shell, and thus could probably
more easily write a cross-platform "virtual OS" that could run on top of
Windows, OSX, etc - and install it with the ease of running an application, as
opposed to fiddling with more sensitive things.

~~~
ornitorrincos
while impressive, this is a userspace program, quite different from an OS,
even acounting for their virtual cpu.

nevertheless nice experiment

------
steelbird
Quick start to get the GUI going (not so obvious from the README):

$ clone
[https://github.com/vygr/ChrysaLisp.git](https://github.com/vygr/ChrysaLisp.git)
ChrysaLisp

$ cd ChrysaLisp

$ sudo apt-get install libsdl2-ttf-dev

$ make -j

$ ./run.sh

To quit:

$ ./stop.sh

~~~
antimass
For a recent macOS version, do:

0) Make sure you have a recent Xcode installed

1) Install the libsdl2 and libsdl2_ttf frameworks under /Library/Frameworks

    
    
       libsdl2: https://www.libsdl.org/release/SDL2-2.0.6.dmg
       sdl2+ttf: https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.dmg
    

2) git clone
[https://github.com/vygr/ChrysaLisp.git](https://github.com/vygr/ChrysaLisp.git)
ChrysaLisp

3) cd ChrysaLisp

4) make (takes about 2s!!)

5) ./run.sh (shows full working gui. Amazing!)

~~~
schpaencoder
Getting SDL2 to be recognized under MacOS is no joy

~~~
scottyelich
correct. I figured out where the frameworks wanted to go -- and it even seems
to match the path for -I, but that doesn't seem to be enough.

\--

Yes, I have both frameworks installed. I even did the brew commands just for
S&G ... same result after make command.

~~~
schpaencoder
Try; xcode-select install

~~~
scottyelich
I ended up changing the "cc" line for darwin to this: cc -o $@ $@.o -lSDL2
-lSDL2_ttf now it compiles (and runs) just fine (for me). YMMV

------
scottyelich
I'm looking for a bare metal boot OS that has internet capabilities -- lisp or
forth based (ONLY). Any pointers would be greatly appreciated.

~~~
nicklaf
Firmworks has a open source implementation of OpenFirmware which is part of
the OpenBIOS project, can be used with Coreboot, and implements TCP/IP with
various protocols including HTTP, all in Forth.

[http://www.firmworks.com/ofwfeatures.htm](http://www.firmworks.com/ofwfeatures.htm)

[http://GitHub.com/openbios/openfirmware](http://GitHub.com/openbios/openfirmware)

~~~
scottyelich
Thank you.

------
avodonosov
Not exactly a Lisp OS - asm and C beneath. Compare to
[https://github.com/froggey/Mezzano](https://github.com/froggey/Mezzano)

------
rurban
So this looks like basically the followup project to the TAOS os which was
ways ahead of its time.
[https://news.ycombinator.com/item?id=9806607](https://news.ycombinator.com/item?id=9806607)

------
xenophonf
I wonder how difficult it would be to move an existing Lisp to bare metal,
like SBCL.

~~~
derefr
Less ambitious: has anyone yet built a Lisp Machine unikernel (i.e. a "Racket
on Xen", like "Erlang on Xen")?

~~~
xenophonf
Would such a thing be a stripped down Linux or NetBSD kernel that ran (e.g.)
SBCL instead of init?

------
autcrock
What this reminded me of most is the Connection Machines, which allowed you to
configure the interprocessor connection topology. It had specialised C,
FORTRAN and Lisp languages. They were also the best looking computers I ever
saw!

------
colesantiago
Very cool, interested in Lisp but I would like to know if any HN'ers would
provide me some insight into why Lisp is so popular?

Does anyone use it in production? Is it comparable to JS?

~~~
DonaldFisk
Lisp is popular? Where?

It was almost mainstream in the 1980s when there were four Lisp Machine
companies (Xerox, Symbolics, Texas Instruments, LMI) and symbolic AI,
particularly expert systems, were used. Not so much now.

I still use it. If you know it you can be much more expressive and productive
in it than in other mainstream languages, and when there's something you need
that's missing from Lisp, you can extend Lisp to include it.

There are reasons it's fallen from favour, some of which lisper has given
here. It's a mistake to languages necessarily succeed or fail on their merits.

------
Annatar
Here is proof that Rust is unnecessary. Lisp comes from the past to save the
future from itself.

~~~
jstewartmobile
We can start a LISP evangelism strikeforce and bomb the Rust threads the way
the Rust guys bomb the C ones.

~~~
rurban
You will be heavily downvoted by the Rust zealots, without any argumentation,
even if your arguments are in their official docs. I try from time to time
because their discrepancy of marketing talk to delivered features is even
worse than with Perl.

Comparing to this lisp os its a bit unfair though. This is an async
distributed actor model os with various practical shortcuts. Refcounted with
manually breaking up cycles. The lisp is very rough, but extremely fast. No
linked lists (i.e. cons cells), just vectors. (Very good idea btw, same as in
potion). A better macro assembler with message passing OO (smalltalk, Erlang
but better than beam). I still want to see the other TAOS features though:
selfrouting network, dynamic binding

~~~
jstewartmobile
Even so, somebody needs to do it. What's the use of HN points if you never
spend them?

PS> musl libc is _beautiful_.

------
galaxyLogic
JavaScript has been called "Lisp in C's clothing". What it lacks is macros
basically but you can get a lot of practical work done in JavaScript and it is
as mainstream as it gets. So how about a JavaScript OS/Machine/Hardware
anybody?

~~~
nv-vn
JavaScript is really nothing like Lisp. Macros/code is data and simple syntax
are basically the defining features of a Lisp. Apart from these, JavaScript's
type system is totally different (way weaker, based on objects but nothing
like CLOS), JS isn't based on lists/pairs as the primary data structure, JS
emphasizes imperative programming, etc. I don't know where this myth came
about (probably because rumor that Brendan Eich initially intended to use
Scheme instead of JS, although this never happened).

~~~
unkown-unknowns
> rumor that Brendan Eich initially intended to use Scheme instead of JS,
> although this never happened

I wonder what'd have happened had he done so. Would it have grown to the size
that JavaScript is at today, or would it have lost to something similar to
JavaScript that some other browser would have implemented?

~~~
jstewartmobile
I believe they hired him under the impression of doing actual Scheme for the
browser, but then they did the old corporate bait-and-switch on him:

"The immediate concern at Netscape was it must look like Java. People have
done Algol-like syntaxes for Lisp but I didn't have time to take a Scheme core
so I ended up doing it all directly and that meant I could make the same
mistakes that others make."

[http://bryanpendleton.blogspot.com/2009/11/coders-at-work-
br...](http://bryanpendleton.blogspot.com/2009/11/coders-at-work-brendan-
eich.html)

------
pjmlp
This is quite cool.

------
xmichael99
For me, calling something an OS requires it to have it's own kernel ... maybe
thats just me, but I think this is the 2nd project this month which has called
itself an OS when in reality it is just a GUI.

~~~
phoe-krk
It already has a kernel, except it uses the host OS's system calls instead of
its own drivers. Once you have a runnable OS that runs as a separate Unix
process in its own address space, it is actually possible to port it over to
bare metal by providing all the modules that the OS would normally provide:
memory management, graphics, device management and HAL, keyboard/mouse input.

See [https://github.com/froggey/Mezzano](https://github.com/froggey/Mezzano)
for something that can run on bare metal.

~~~
mypalmike
> port it over to bare metal by providing all the modules that the OS would
> normally provide: memory management, graphics, device management and HAL,
> keyboard/mouse input.

In other words, it can become an OS if you merely add to it the exact things
that define an OS.

~~~
pjmlp
That is how we programmed in the 80's on home computers and it is the norm
still in 2017 on many micro-controlers.

The language runtime is the OS.

~~~
mypalmike
I'm not interested in debating the definition of OS. If the textbooks are as
wrong as you imply, I guess I'm wrong too.

~~~
pjmlp
So which textbooks do you want to start with?

I pick "PC INTERN: system programming", 1992.

[https://www.amazon.de/PC-Intern-Programming-Encyclopedia-
Dev...](https://www.amazon.de/PC-Intern-Programming-Encyclopedia-
Developers/dp/1557551456)

~~~
mypalmike
A reference for MSDOS programming on a German amazon page... Am I missing the
joke?

Tanenbaum and Silberschatz both have excellent textbooks covering the
fundamentals of Operating Systems. Neither book focuses much on "language
runtimes".

~~~
pjmlp
I live in Germany, do not always bother to check if the URL contains locale
information.

Anyone that actually programmed MS-DOS, knows that we used to program directly
against the hardware for actual work. MS-DOS was nothing more than what is
usually known as _monitor_ in OS literature.

Continuing the texts from people more relavant to the CS world than me,

"An operating system is a collection of things that don't fit into a language.
There shouldn't be one." \- Dan Ingalls on

[https://archive.org/details/byte-
magazine-1981-08](https://archive.org/details/byte-magazine-1981-08)
[https://www.cs.virginia.edu/~evans/cs655/readings/smalltalk....](https://www.cs.virginia.edu/~evans/cs655/readings/smalltalk.html)

"Building Parallel, Embedded, and Real-Time Applications with Ada" \- John
McCormick

[https://www.amazon.co.uk/Building-Parallel-Embedded-Real-
Tim...](https://www.amazon.co.uk/Building-Parallel-Embedded-Real-Time-
Applications/dp/0521197163/ref=sr_1_2?ie=UTF8&qid=1452524775&sr=8-2&keywords=John%20McCormick%20Ada)

"Project Oberon: The Design Of An Operating System And Compiler" \- Niklaus
Wirth

[https://www.amazon.co.uk/Project-Oberon-Design-Operating-
Com...](https://www.amazon.co.uk/Project-Oberon-Design-Operating-
Compiler/dp/0201544288/ref=sr_1_1?s=books&ie=UTF8&qid=1507977358&sr=1-1&keywords=project+oberon)

And not to let this just be theory, here are a few examples of commercial
products using the language runtime to interface with the hardware.

[http://www.astrobe.com/default.htm](http://www.astrobe.com/default.htm)

[https://www.mikroe.com/products/#compilers-
software](https://www.mikroe.com/products/#compilers-software)

[https://www.ptc.com/en/products/developer-
tools](https://www.ptc.com/en/products/developer-tools)

~~~
mypalmike
I programmed MSDOS assembly and on 80s 8-bit machines back in the day too, so
you can quit the "back in my day" routine. It was my day too.

Like I said, I'm not interested in debating the definition of OS. Best
regards.

------
rbanffy
Could look more like a Lisp Machine...

