1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-04-09 16:40:38 +00:00

Initial test for slow, minimal LISP - DRAWL

This commit is contained in:
David Schmenk 2024-06-04 19:02:04 -07:00
parent 3fd11ca0d4
commit ec14660f87

67
src/toolsrc/drawl.pla Normal file
View File

@ -0,0 +1,67 @@
include "inc/cmdsys.plh"
word readline
def num_parse(instr)
while ^instr >= '0' and ^instr <= '9'
putc(^instr)
instr++
loop
return instr
end
def sym_parse(instr)
while ^instr > ')' and toupper(^instr) <= 'Z'
putc(toupper(^instr))
instr++
loop
return instr
end
def exp_parse(instr)
while ^instr
when ^instr
is '!'
return 0
is ' '
instr++
break
is '('
putln
instr = exp_parse(instr + 1)
break
is ')'
putln
return instr + 1
is '0'
is '1'
is '2'
is '3'
is '4'
is '5'
is '6'
is '7'
is '8'
is '9'
putc('.')
instr = num_parse(instr)
break
otherwise
if ^instr > ')' and toupper(^instr) <= 'Z'
putc('.')
instr = sym_parse(instr)
else
putc('\\')
putc(^instr)
instr++
fin
wend
loop
return instr
end
repeat
readline = gets('?'|$80)
^(readline + ^readline + 1) = 0
until not exp_parse(readline + 1)
done