1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-10 12:47:45 +03:00
Commit Graph

3 Commits

Author SHA1 Message Date
Joel Martin
01e8850d43 Basic: Reduce GOSUB use. Partial self-host to step3
step4 runs out of space attempting to load the program. Step2 and
step3 run out of memory (stack exhaustion) for more complicated forms.

- Use GOTO with return label on our stack instead of GOSUB for:
    - APPLY function in types.in.bas
    - "apply", "map" and "swap!" core functions
- Implement DO TCO. Change EVAL_AST to detect if we are called from DO
  and exit one element early.
- Remove GOSUB recursion from EQUAL_Q
- Inline PAIR_Q. Reduce REPLACE stack use.
- Remove one level of GOSUB/stack by calling REP with GOTO
- Simplify mal/step2_eval.mal to remove use of (or ) macro in
  eval_ast.
- Fix ON GOTO/GOSUB line detection in basicpp
2016-10-24 23:29:27 -05:00
Joel Martin
85d70fb791 Basic: step6 basics and atoms. Fix strings.
Also:
- command lines arguments are implemented by creating a file
  ".args.mal" that contains a list of arguments and that is loaded by
  the run script (load-file) into -*ARGS*-. The rest is put in *ARGV*
  and the first element is pulled out and used as the script name.
- fix string reading/printing using new REPLACE function
- add RE function to skip printing and to get back evaluated value
  (result must be freed by caller). Needed for step6 to get first
  argument pointer for scripting.
- Sync earlier steps
- add cons, first, rest to support parsing the command line.
- eval is implemented as standard function in core.in.mal
- fix println bug (using PR_STR rather than PR_STR_SEQ)
- change sequence printing to save the initial sequence type on the
  stack and use that for the ending sequence delimeter. This way
  sequences of one type can still use the tail of sequences of
  a different type but still be considered the initial type.
2016-09-19 21:23:21 -05:00
Joel Martin
47def37ef4 Basic (C64 v2): step0
This works with cbmbasic from https://github.com/mist64/cbmbasic. The
cbmbasic interpreter needs to be on the PATH.

The actually sources are *.in.bas which are "compiled" to *.bas using
the qb2cbm.sh. qb2cbm.sh translates from a QBasic-ish format to a line
numbered source with include files inlined (REM $INCLUDE: 'file.bas').
One additional advantage is that the *.in.bas versions can also be
indented and qb2cbm.sh will remove the indenting in the translated
code.
2016-09-04 20:25:26 -05:00