6 ms·
An ARM Assembler Written in Lisp
- johndoe0815 3y agoAnd here's a Lisp written in ARM Assembler :) https://github.com/marcpaq/arpilisp https://github.com/marcpaq/arpilisp
- pjmlp 3y agoSo the base components of a future Lisp Machine are available. :)
- johndoe0815 3y agoThere's something even better for the Raspberry Pi (2B only at the moment) - interim OS, a bare metal Lisp by Lukas Hartmann of MNT Research, the creator of the MNT Reform laptop. The original site seems to be unavailable right now, but it's mirrored on archive.org: https://web.archive.org/web/20230331151459/http://interim-os.com/ https://web.archive.org/web/20230331151459/http://interim-os...
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- nathell 3y agoI once wrote a rudimentary x86 assembler in about 250 lines of Clojure: https://github.com/nathell/lithium/blob/master/src/lithium/assembler.clj https://github.com/nathell/lithium/blob/master/src/lithium/a... In general, I find that s-expressions are actually a nice syntax for assembly languages. For x86, they kind of sidestep the AT&T vs. Intel conundrum, and you get to write macro-like functions in the host Lisp that compile down to s-expressions.
- agumonkey 3y agodoesn't clang use a sexp like notation for some IR ?
- mejutoco 3y agoand webassembly.
- agumonkey 3y agoOh that's it, I was reading some wasm articles last month.
- excircul 3y agoGCC’s RTL does https://gcc.gnu.org/onlinedocs/gccint/RTL.html https://gcc.gnu.org/onlinedocs/gccint/RTL.html
- muricula 3y agoClang's ir is more c like. I can't find a link to a good example offhand, but if you pass the right combinations of flags to clang you can dump it.
- kazinator 3y agoTo rub salt in Stallman's wounds.
- mepian 3y agoIn their twilight years Symbolics implemented their own DEC Alpha assembler in Common Lisp to aid the development of their Lisp machine emulator: http://pt.withy.org/publications/VLM.html http://pt.withy.org/publications/VLM.html You can still find its leaked source code on the internet. "We built a prototype of the emulator in C, but it quickly became obvious that we could not achieve the level of performance desired in C. Examination of code emitted by the C compiler showed it took very poor advantage of the Alpha's dual-issue capabilities. A second implementation was done in Alpha assembly language and is the basis for the current product. We built a number of tools (in Lisp, running on Genera) that supported the level of complexity of the assembly language program we were attempting. A translator was built that allowed us to use Lisp as a macro language. One of the primary benefits of using Lisp was that we could use all our normal development tools, including incremental patching, even though we were working in another machine's assembly language. Even more beneficial, however, was that early on in the project, we were able to easily graft on to the translator a cycle-counting tool that allowed one to easily and automatically "preview" any code fragment and see its total cycle cost, dual-issues that were taken or missed, and any free stall slots. Because this tool was integrated directly with the Genera editor, we were able to pro-actively optimize our code, right from the start. The full paper describes this tool in more detail, with examples, and compares it with tools that have recently become available from DEC that attempt to automatically re-organize executable files. It is our claim that our tool, because of its interactive nature, offers many more opportunities for optimization."
- abecedarius 3y agoReminds me of the predecessor for this 6502 assembler: https://www.pagetable.com/?p=848 https://www.pagetable.com/?p=848 -- the comments include a note by the author, Chip Morningstar of Habitat, saying the Lisp assembler was terribly slow on a VAX.
- lispm 3y agoThe Genera code for ARM64 and Intel 86-64 is also written that way. Clozure CL should also include an inline assembler. Lisp assemblers date back to the 60s.
- jdontillman 3y ago
- erichocean 3y agoFactor (a modern stack language) has assemblers for x86 and PowerPC (last I checked), and should be easy to also incorporate ARM.
- icedata 3y agoAt LCSI we had assemblers and debugging tools for 6502, x86 and others written in LMI Lisp, which we used to create several popular commercial versions of Logo.
- monocasa 3y agoA lot of lisps end up writing their own assemblers, the lisp model of 80/20ing your own compiler with every compiler step being a different set of s-expressions as sorts of intermediate representations works best holistically. On the old lisp machines even the microcode source would be specific s-expressions that as a final pass would be converted into the actual bit pattern needed by the machine. This paradigm is well seen in the GOAL (Game Oriented Assembly Lisp) code for Jak & Daxter that could mix relatively standard lisp, MIPS asm, and PS2 custom vector asm all within the same function: https://web.archive.org/web/20070127022728/http://lists.midnightryder.com/pipermail/sweng-gamedev-midnightryder.com/2005-August/003804.html https://web.archive.org/web/20070127022728/http://lists.midn...
- senkora 3y agoAlso seen in the nanopass compiler framework: http://nanopass.org/ http://nanopass.org/
- rprospero 3y agoThank you for the explanation about the microcode. Many years ago, someone was explaining to me that Lisp machines were Lisp “all the way down”. There were no layers that you couldn’t reprogram with Lisp. When pressed for details, he claimed that even the band gap potential in the transistors of the machine could be reprogrammed, because the transistors were just an abstraction over more Lisp. Your explanation makes far more sense.
- lispm 3y agoIn the early days the CPUs had loadable microcode. With new operating system versions came language extensions for Lisp. Then one also got a new version of the microcode, which then had been extended for, say, inclusion of an instruction for OOP method dispatch. One also could compile some code to microcode. Later the CPUs were actually Microprocessors (from TI and Symbolics). At least for the Symbolics Ivory microprocessor, the microcode no longer was loadable.
- r9550684 3y ago
- snvzz 3y agoRISC-V next?
- robert-brown 3y agoSBCL has been ported to RISC-V, so it has an assembler for that architecture.
- cylinder714 3y agoSBCL: the ultimate assembly code breadboard (2014): http://pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/ http://pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembly-cod...
- kazinator 3y agoMajor Lisp implementations have things like this. E.g. look at the defarmlap function definitions in Clozure Common Lisp: https://github.com/Clozure/ccl/blob/master/level-0/ARM/arm-hash.lisp https://github.com/Clozure/ccl/blob/master/level-0/ARM/arm-h... .. and other files, plus other architectures in other subdirectories.