Compiling to assembler


After seeing the speed difference from running assembler, I am curious if there are methods of compiling/evaluating uLisp instructions into assembler in a running environment. This would likely only be possible for a subset of functionality but it seems to me that it would be a useful option. Is this even possible on a fast microcontroller, or would we need macros?

On a side note, I’m curious if anyone has considered the Clockwork uConsole [] as a target platform for a hand held lisp machine. I’m seriously tempted to pick up the risc-v version to play around with even if it is severely under powered compared to the other options. I like the idea of building up a lisp os for risc-v.

How difficult would it be to create drivers for the keyboard and display?


I have been considering this concept for some time. I had a lot of fun implementing rule 110 in assembler and seeing the massive speedup, and it was also enjoyable that I could modify the assembler to add new instructions. I think the main difficulty with JIT is just where you’re allowed to execute from on a given architecture.

Targeting higher end 32-bit archs like RiscV and ARM is probably the best choice for this kind of work. You could of course write the JIT-compilation routines in Lisp itself, which is something I thought of while doing interactive development of an assembly routine at the same time I was enhancing the assembler itself. Like you said, it could start as a limited subset of functionality and just exit if it found some construct it couldn’t compile.

The clockworkpi devices look amazing - I’ve been looking for something like this for a while, actually. A portable device that looks a lot like a Blackberry with something I can hack into a Commodore 64 that runs Lisp instead of BASIC.

I also want to work out a good way to have “pure space” - the OS should be able to be written in Lisp as well. This isn’t as feasible on lower-end archs but could be done on high end RiscV / ARM archs.


@nanomonkey Thanks for starting this discussion.

My motivation for developing the assemblers for the AVR, ARM, and RISC-V platforms was to test the feasibility of dynamically compiling code into RAM and executing it there, and on these platforms at least I think it would be feasible to develop a Lisp compiler that would compile Lisp into machine code.

It’s on my to-do list, but if someone else gets there first that would be great.


I’d love to contribute to this, but personally I don’t know the first place to start. I would assume that there are lisp systems that were produced in the past that would point us to the building blocks.

What do you see as the next steps for uLisp the language. What are the next steps for uLisp to be a micro runtime environment or OS?


I asked a similar question two years ago. See: What new features would you like to see in uLisp?

Since then I’ve added the following proposed features from that list:

  • Arrays
  • Format
  • Stack overflow
  • Outputting to a string
  • A time function

I’m pretty happy that the language itself is now complete enough for the sorts of target applications that uLisp is intended for and I don’t have any plans to extend it, unless there are specific requests.

The main thing that I think that uLisp needs are not in the language itself, but a better editing environment, to make it easier to enter programs and subsequently edit them. See: A better IDE for uLisp?

If this could be done as an extension to the Arduino IDE it might avoid the need to write a complete IDE and editor from scratch. I’d welcome suggestions.