Yet another new implementation of an old language for a limited environment; an 8 bit Apple in this case. They say if you really want to understand a computer language, write your own compiler/interpreter for it. Since I've always been fascinated what others see in LISP, I can now say I've scratched that itch.
Should you find yourself awake at 3 AM and unable to get back to sleep, this may be the cure. An S-expression parser/evaluator/printer written in PLASMA, a byte code compiler/VM running on an 8 bit 6502 at 1 MHz. See what I did by naming it DRAWL?
A terrible video showing it in action: https://youtu.be/wBMivg6xfSg
A quick description of the interpreter and floppy disk image to play along: https://github.com/dschmenk/PLASMA/blob ... c/DRAWL.md
If there are any LISP die-hard fans here, please be kind.
DRAWL (LISP 1.5) symbolic processing
Re: DRAWL (LISP 1.5) symbolic processing
Nice! I am only a theoretical fan of Lisp, but I appreciate what you've built there.
Re: DRAWL (LISP 1.5) symbolic processing
Thanks Ed. Although I appreciate the formalism and simplicity of LISP, I believe I'll remain a theoretical fan as well!
Re: DRAWL (LISP 1.5) symbolic processing
Well, I couldn't leave well enough alone. So I implemented the rest of LISP 1.5 including some later extensions. Pretty complete and not as weird as you might think. Works surprisingly well on an Apple II. I may change my mind about LISP (except the parenthesis - see what I did here?)
I wouldn't write a full application in LISP 1.5, but it can make for a pretty cool programmable calculator. I've implemented 32 bit integers and 80 bit floating point with transcendentals by way of the SANE library. Hexadecimal input/output and bit-wise operators makes it pretty useful. Echo to a printer for hard copy, but can also be used in an emulated environment to capture output externally.
Video of DRAWL in action: https://www.youtube.com/watch?v=MdKZIrfPN7s
Updated GitHub docs: https://github.com/dschmenk/PLASMA/blob ... c/DRAWL.md
Blog: http://schmenk.is-a-geek.com/wordpress/?p=365
I wouldn't write a full application in LISP 1.5, but it can make for a pretty cool programmable calculator. I've implemented 32 bit integers and 80 bit floating point with transcendentals by way of the SANE library. Hexadecimal input/output and bit-wise operators makes it pretty useful. Echo to a printer for hard copy, but can also be used in an emulated environment to capture output externally.
Video of DRAWL in action: https://www.youtube.com/watch?v=MdKZIrfPN7s
Updated GitHub docs: https://github.com/dschmenk/PLASMA/blob ... c/DRAWL.md
Blog: http://schmenk.is-a-geek.com/wordpress/?p=365
-
White Flame
- Posts: 704
- Joined: 24 Jul 2012
Re: DRAWL (LISP 1.5) symbolic processing
As a Common Lisper & semi Lisp historian this looks great! Having that intermediate VM certainly makes tons of sense. Bookmarked and will reference it.
Re: DRAWL (LISP 1.5) symbolic processing
I've wrapped up DRAWL by incorporating extensions like macros and strings. Also added a few Apple II functions for screen and keyboard interactivity. Dare I say it's close to a real programming language. The macros really help make the code less weird. There's one that provides a way to write functions such as this,
by cleaning up a lot of the extra verbiage needed to get something defined. Strings and associated functions certainly makes it feel like a general purpose language.
I believe DRAWL is a pretty palatable version of LISP 1.5 - before it got too big. It doesn't take much to understand the language, but a much greater investment to be productive in it.
Code: Select all
(DEFPRO DUMMYFUNC (ARG1, ARG2) ; ARGUMENTS
(LOCAL1, LOCAL2) ; LOCAL VARS
;
(SETQ LOCAL1 (+ ARG1 ARG2))
(SETQ LOCAL2 (* ARG1 ARG2))
(PRINT LOCAL1 LOCAL2)
(RETURN (- LOCAL2 LOCAL1))
)
I believe DRAWL is a pretty palatable version of LISP 1.5 - before it got too big. It doesn't take much to understand the language, but a much greater investment to be productive in it.
Re: DRAWL (LISP 1.5) symbolic processing
I've spent over a decade mostly in Common Lisp, except for the last few years. I've been enjoying C and asm more lately/ But yeah, once you are used to sexps, every syntax seems completely arbitrary and foolish.
I'm looking for something to do with my new fpga 65c02 toy, and will definitely check this out. Away from my Apple ][ unfortunately and indefinitely...
I'm looking for something to do with my new fpga 65c02 toy, and will definitely check this out. Away from my Apple ][ unfortunately and indefinitely...