1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-12-29 01:30:22 +00:00

Add DRAWL page

This commit is contained in:
David Schmenk 2024-07-09 12:21:17 -07:00
parent d920a14c8f
commit 43bdb61043
5 changed files with 40 additions and 8 deletions

View File

@ -4,7 +4,9 @@
[Change List](https://github.com/dschmenk/PLASMA/blob/master/doc/Version%202.1.md#changes-in-plasma-for-211-release)
[Get single boot floppy of FORTH for PLASMA 2.11](https://github.com/dschmenk/PLASMA/blob/master/images/apple/PLFORTH.PO)
[FORTH implemented in PLASMA](https://github.com/dschmenk/PLASMA/blob/master/doc/PLFORTH.md)
[LISP 1.5 implemented in PLASMA](https://github.com/dschmenk/PLASMA/blob/master/doc/DRAWL.md)
# The PLASMA Programming Language

32
doc/DRAWL.md Normal file
View File

@ -0,0 +1,32 @@
# LISP 1.5 implemented in PLASMA. LISP interpreted in a bytecode VM runnin on a 1 MHz 6502 is going to be sssllllooooowwwww. So I called this implementation DRAWL in keeping with the speech impediment theme.
DRAWL represents an exploration REPL language for the PLASMA environment.
It isn't meant to be a full-blown programming language, more of an interactive sandbox for playing with S-expressions.
## Missing features of LISP 1.5 in DRAWL
- The PROG feature isn't present. Programming is limited to interpreting lambda S-expressions
- Number values are limited to 32 bit integera, no floating point
- Deep recursion. The 6502 architecture limits recursion, so don't expect too much here
However, the code is partitioned to allow for easy extension so some of these missing features could be implemented.
## Features of DRAWL
- 32 bit integers. Hey, better than you probably expected
- Recursion handles about nine levels deep. Better than nothing
- Fully garbage collected behind the scenes
- Optionally read LISP source file at startup
LISP is one of the earliest computer languages. As such, it holds a special place in the anals of computer science. I've always wanted to learn why LISP is held in such high regard by so many, so I went about learning LISP by actually implementing a LISP interpreter in PLASMA. PLASMA is well suited to implement other languages due to its rich syntax, performance and libraries.
## Links
Here are some links to get you started.
LISP 1.5 Manual: https://archive.org/details/bitsavers_mitrlelisprammersManual2ed1985_9279667
Video showing DRAWL in action:
Preconfigured PLASMA ProDOS boot floppy for DRAWL: https://github.com/dschmenk/PLASMA/blob/master/images/apple/DRAWL.po

View File

@ -338,12 +338,8 @@ end
def is_int(c); return c >= '0' and c <= '9'; end
def is_alpha(c)
return c >= 'A' and c <= 'z'
end
def is_alphasym(c)
return c >= '0' and c <= 'z'
return (c >= '*' and c <= 'z') and (c <> '.') and (c <> ',')
end
def parse_int(evalptr)#2 // return evalptr, intptr
@ -439,9 +435,9 @@ export def parse_expr(evalptr, level, refill)#2 // return evalptr, exprptr
elemptr = NULL
break
otherwise
if (^evalptr == '-' and is_int(^(evalptr+1))) or is_int(^evalptr)
if is_int(^evalptr) or (^evalptr == '-' and is_int(^(evalptr+1)))
evalptr, elemptr = parse_int(evalptr)
elsif is_alpha(^evalptr)
elsif is_alphasym(^evalptr)
evalptr, elemptr = parse_sym(evalptr)
else
putc('\\')

View File

@ -22,3 +22,4 @@ cat lisp/set.lisp | ./ac.jar -ptx DRAWL.po lisp/SET.LISP TXT
cat lisp/list.lisp | ./ac.jar -ptx DRAWL.po lisp/LIST.LISP TXT
cat lisp/maplist.lisp | ./ac.jar -ptx DRAWL.po lisp/MAPLIST.LISP TXT
cat lisp/gcd.lisp | ./ac.jar -ptx DRAWL.po lisp/GCD.LISP TXT
cat lisp/fact.lisp | ./ac.jar -ptx DRAWL.po lisp/FACT.LISP TXT

View File

@ -182,6 +182,7 @@ cp lisp/set.lisp prodos/bld/lisp/SET.LISP.TXT
cp lisp/list.lisp prodos/bld/lisp/LIST.LISP.TXT
cp lisp/maplist.lisp prodos/bld/lisp/MAPLIST.LISP.TXT
cp lisp/gcd.lisp prodos/bld/lisp/GCD.LISP.TXT
cp lisp/fact.lisp prodos/bld/lisp/FACT.LISP.TXT
#mkdir prodos/bld/examples
#cp samplesrc/examples/ex.1.pla prodos/bld/examples/EX.1.PLA.TXT