QQ_QUOTE:
REM ['quote, ast]
- AS$="quote":T=5:GOSUB STRING
- B2=R:B1=A:GOSUB LIST2
- AY=B2:GOSUB RELEASE
+ B$="quote":T=5:GOSUB STRING
+ B=R:A=A:GOSUB LIST2
+ AY=B:GOSUB RELEASE
GOTO QQ_DONE
IF S$(Z%(B,1))<>"splice-unquote" THEN QQ_DEFAULT
REM ['concat, ast[0][1], quasiquote(ast[1..])]
- B=Z%(A,1)+1:GOSUB DEREF_B:B2=B
- AS$="concat":T=5:GOSUB STRING:B3=R
- B1=T6:GOSUB LIST3
+ B=Z%(A,1)+1:GOSUB DEREF_B:B=B
+ B$="concat":T=5:GOSUB STRING:C=R
+ A=T6:GOSUB LIST3
REM release inner quasiquoted since outer list takes ownership
- AY=B1:GOSUB RELEASE
- AY=B3:GOSUB RELEASE
+ AY=A:GOSUB RELEASE
+ AY=C:GOSUB RELEASE
GOTO QQ_DONE
QQ_DEFAULT:
X=X+1:X%(X)=T6
REM A set above to ast[0]
CALL QUASIQUOTE
- B2=R
+ B=R
REM pop T6 off the stack
T6=X%(X):X=X-1
- AS$="cons":T=5:GOSUB STRING:B3=R
- B1=T6:GOSUB LIST3
+ B$="cons":T=5:GOSUB STRING:C=R
+ A=T6:GOSUB LIST3
REM release inner quasiquoted since outer list takes ownership
- AY=B1:GOSUB RELEASE
- AY=B2:GOSUB RELEASE
- AY=B3:GOSUB RELEASE
+ AY=A:GOSUB RELEASE
+ AY=B:GOSUB RELEASE
+ AY=C:GOSUB RELEASE
QQ_DONE:
END SUB
IF ER<>-2 THEN GOTO EVAL_RETURN
- REM AZ=A:PR=1:GOSUB PR_STR
+ REM AZ=A:B=1:GOSUB PR_STR
REM PRINT "EVAL: "+R$+" [A:"+STR$(A)+", LV:"+STR$(LV)+"]"
GOSUB DEREF_A
IF ER<>-2 THEN GOTO EVAL_RETURN
REM set a1 in env to a2
- K=A1:V=R:GOSUB ENV_SET
+ K=A1:C=R:GOSUB ENV_SET
GOTO EVAL_RETURN
EVAL_LET:
X=X+1:X%(X)=E: REM push env for for later release
REM create new environment with outer as current environment
- O=E:GOSUB ENV_NEW
+ C=E:GOSUB ENV_NEW
E=R
EVAL_LET_LOOP:
IF Z%(A1,1)=0 THEN GOTO EVAL_LET_LOOP_DONE
IF ER<>-2 THEN GOTO EVAL_LET_LOOP_DONE
REM set environment: even A1 key to odd A1 eval'd above
- K=A1+1:V=R:GOSUB ENV_SET
+ K=A1+1:C=R:GOSUB ENV_SET
AY=R:GOSUB RELEASE: REM release our use, ENV_SET took ownership
REM skip to the next pair of A1 elements
Z%(R,0)=Z%(R,0)+1
REM set A1 in env to A2
- K=A1:V=R:GOSUB ENV_SET
+ K=A1:C=R:GOSUB ENV_SET
GOTO EVAL_RETURN
EVAL_MACROEXPAND:
IF ER=-2 OR Z%(A,1)=0 THEN GOTO EVAL_RETURN
REM create environment for the catch block eval
- O=E:GOSUB ENV_NEW:E=R
+ C=E:GOSUB ENV_NEW:E=R
GOSUB EVAL_GET_A2: REM set A1 and A2
A=A2:GOSUB EVAL_GET_A2: REM set A1 and A2 from catch block
REM create object for ER=-1 type raw string errors
- IF ER=-1 THEN AS$=ER$:T=4:GOSUB STRING:ER=R:Z%(R,0)=Z%(R,0)+32
+ IF ER=-1 THEN B$=E$:T=4:GOSUB STRING:ER=R:Z%(R,0)=Z%(R,0)+32
REM bind the catch symbol to the error object
- K=A1:V=ER:GOSUB ENV_SET
+ K=A1:C=ER:GOSUB ENV_SET
AY=R:GOSUB RELEASE: REM release our use, env took ownership
REM unset error for catch eval
- ER=-2:ER$=""
+ ER=-2:E$=""
A=A2:CALL EVAL
EVAL_FN:
GOSUB EVAL_GET_A2: REM set A1 and A2
- A=A2:P=A1:GOSUB MAL_FUNCTION
+ A=A2:B=A1:GOSUB MAL_FUNCTION
GOTO EVAL_RETURN
EVAL_INVOKE:
REM if error, pop and return f/args for release by caller
R=X%(X):X=X-1
- ER=-1:ER$="apply of non-function":GOTO EVAL_RETURN
+ ER=-1:E$="apply of non-function":GOTO EVAL_RETURN
EVAL_DO_FUNCTION:
REM regular function
E4=E: REM save the current environment for release
REM create new environ using env stored with function
- O=Z%(F+1,1):BI=Z%(F+1,0):EX=AR:GOSUB ENV_NEW_BINDS
+ C=Z%(F+1,1):A=Z%(F+1,0):B=AR:GOSUB ENV_NEW_BINDS
REM release previous env if it is not the top one on the
REM stack (X%(X-2)) because our new env refers to it and
E=R:GOTO EVAL_TCO_RECUR: REM TCO loop
EVAL_RETURN:
- REM AZ=R: PR=1: GOSUB PR_STR
+ REM AZ=R: B=1: GOSUB PR_STR
REM PRINT "EVAL_RETURN R: ["+R$+"] ("+STR$(R)+"), LV:"+STR$(LV)+",ER:"+STR$(ER)
REM release environment if not the top one on the stack
GOSUB RELEASE_PEND
REM trigger GC
- #cbm TA=FRE(0)
- #qbasic TA=0
+ #cbm T=FRE(0)
+ #qbasic T=0
REM pop A and E off the stack
E=X%(X-1):A=X%(X):X=X-2
REM PRINT(A) -> R$
MAL_PRINT:
- AZ=A:PR=1:GOSUB PR_STR
+ AZ=A:B=1:GOSUB PR_STR
RETURN
REM RE(A$) -> R
LV=0
REM create repl_env
- O=-1:GOSUB ENV_NEW:D=R
+ C=-1:GOSUB ENV_NEW:D=R
REM core.EXT: defined in Basic
E=D:GOSUB INIT_CORE_NS: REM set core functions in repl_env
PRINT_ERROR:
REM if the error is an object, then print and free it
- IF ER>=0 THEN AZ=ER:PR=0:GOSUB PR_STR:ER$=R$:AY=ER:GOSUB RELEASE
- PRINT "Error: "+ER$
- ER=-2:ER$=""
+ IF ER>=0 THEN AZ=ER:B=0:GOSUB PR_STR:E$=R$:AY=ER:GOSUB RELEASE
+ PRINT "Error: "+E$
+ ER=-2:E$=""
RETURN