The (def-struct) stuff is part of the assembler ! Not the Lisp.
Same with (def-enum) etc.
I am going to have to write a document to clearly state where these boundaries between the Lisp, the C-Script and the VP layers. I realise it's not that obvious sometimes.
All objects used by the Lisp are instances of classes from the class library, ie that stuff in class/ folder.
These instances are ref counted objects, as they are derefed and they drop to 0 refs they get deinited and freed.
The Lisp is constructed from these, for example Lists in the Lisp are an instance of the class/vector, numbers are an instance of class/num, the environment is a chain of class/hmap etc.
So yes, you do have GC if you don't make cycles, and you do have to care about not doing that just as you would in C++.
That code is using the C-Script assembler prototyping macros. It will produce VP assembler output, but lets you work without worrying about registers while you're getting stuff going.
Have a read through the docs/ASSIGNMENT.md file to see how this all fits together.
There is currently no GC, by choice, but I recently did some work to assist the Stats app that I added recently that could lead to me implementing a GC at some point in the future.
There is a start on documentation in the docs/ folder. I know it's sparse at present I do aim to add more over time.
The system can build itself from source after clean, on my 2014 Macbook in under 0.4s. It's not exactly a standard benchmark though, but it's not slow considering that's a Lisp (like) interpreter doing all the compiling and assembling !. Footprint at the moment for everything is 158KB.
The snapshot.zip file contains 3 separate snapshots for the 3 ABIs supported currently.
It's not bound to any host OS. I am using SDL to provided a simple abstraction to open a Window and obtain key and mouse input. I use very little of the SDL features, just a rectangle fill and rectangle bit blit. See the gui/ctx/class.inc for all those, everything else in the GUI, like the compositor and vector graphics library, widgets et al are done in VP on the CrysaLisp side.
I have a small abstraction to the host OS via the sys/pii/functions, these just use the jump table you can see in the main.c file. Any host OS should be able to compile the main.c with little or no changes, but eventually there will be a native filesystem available from VP/Lisp.
I will be doing direct bare metal hardware support, and there are things happening on that front but I can't talk about that here.
But during my experimentation stage it was very useful to have it running hosted, and I'll keep the hosted version running going forward as it provides a nice dev environment.
I do have a plan to get a version done that could boot under VMWare etc, but I've only got so much time on my hands and have to spread myself over the whole codebase as best I can. :)
Just a quick comment till I can get home. There are three main layers of in use. The more Lisp like layer in apps/ and cmd/. The lowest level VP assembler and an assembler with stack variables and expression compiler I call C-Script. This is my hobby and a follow up to Taos that I did back in the 90’s. See ‘Virtual Processor’ page on Wikipedia for link articles of various scans from back then. Got to head into the car now.....
Thanks again folks for the interest. You catch me yet again when I’m at work but I’ll try answer question in an hour or so once I get home. Regards to all. Chris
Yes, go grab a copy and start playing with some simple apps. I'd love others to get more involved. Expanding the demo apps and maybe adding useful features to the class libs. Maybe tweaking the VP optimiser with some extra cases. New platform ports like the Windows port soon to come. New UI widgets etc. I'm open to any ideas.
I wasn't trying to create a Lisp, at least not at first. I started with a simple VP (Virtual Processor) macro set for NASM in order to look again at some issues raised by my old Taos OS back in the 90's.
More of a personal project to work out some angst to start with.
I used the macro set to create a simple task switcher and get myself to the stage of creating a simulation of a multi-cpu network like the old Transputer days. I wanted to play around with various routing and task distribution ideas. That's probably when ChrysaLisp was just called AsmKernel and the first link appeared on Hacker News, with a 'but what is it...' set of comments.
Around this time I was having issues keeping the compilation performance up due to trying to get NASM macros to do what I wanted. I contacted the NASM forums to ask if there was any chance of getting some extra features added to NASM, but that wasn't to happen. And that's when I decided to write my own assembler.
I've been having a long running debate with a friend, Darren, about Lisp for many years :) He’s crazy about it and has always been pushing me to try it. So I decided to create a Lisp interpreter and code the assembler using that Lisp interpreter. And looking through the project commits you’ll see how that work went.
Pretty soon I had a reasonable Lisp, all be it with my own brand of quirks. And I quickly managed to port over the VP assembler source to the new format. Lisp style () but apart from that pretty much just raw VP assembler. And yes, Darren, Lisp was good and the assembler was crazy powerful being written in Lisp ! So Darren won me round to Lisp.
The next stage was that I wanted to be able to have a slightly higher level to code in, for prototype assembler functions, and that’s when I used the Lisp to add higher level support for stack variables and a C like syntax for expression parsing. The idea here was not to create a full blown C/C++ compiler, but to let me hammer out assembler code without worrying about register numbers and so forth. But I was always intent on converting the time critical functions to the lower level raw VP code.
I had also been experimenting with a GUI based on a software compositer I wrote back in 1990, and so that got included in the project, and eventually I got that hooked up to the Lisp so I could create GUI apps in Lisp with no assembler. Most of the time in these apps is spent in VP coded optimised functions anyway.
Along the way I’ve coded up the VP macro set for the ARM64. Which got me up and running on the Raspberry PI. And recently I’ve pushed towards a Windows port after some nudging from one of the projects recent followers.
There is still lots to do, and many many things I’d like to clean up. But It’s been a labour of love so far as well as personal therapy :)
Hi folks. Chris Hinsley here. Thanks for the interest again. Sorry the README is a bit of a jumble. I’m just heading home from work ATM I’ll try answer questions best I can once I get back. Regards Chris
I’m not going to reply to anything on this thread. But this may be interesting.
Chris