Wed Jun 3 10:42:16 CEST 2009
old comments about bootstrapping
I'm running in circles.. Good I write things down, now i just need to
read them from time to time!
;; I've been looking for a long time to find a solution to writing a
;; frontend that's ANS Forth compatible. I'm still not sure wheter it
;; is really useful at this point, but if it is not too difficult, it
;; might be a nice addition that enables the inclusion of Staapl into
;; a more traditional Forth based project.
;; The problem in itself isn't very difficult:
;; * find a Forth written in Forth + a small set of primitives
;; * implement the primitives.
;; * bootstrap the compiler
;; However, I'd like to do it in a way that enables some more
;; After pondering this for a while, I think this might be an
;; interesting approach: Write a simulated Forth, use it to generate a
;; memory image, and translate the compiled threaded code to run on
;; top of Scat's Forth / Coma.
;; Doing this in a way that enables gradual offloading to the target
;; is not that simple. Wanting more control over dictionary format
;; and execution model (i'd like to use STC primitives) makes things
;; quite challenging.
;; core wordset:
;; ! # #> #S ' ( * */ */MOD + +! +LOOP , - . ." / /MOD 0< 0= 1+ 1- 2!
;; 2* 2/ 2@ 2DROP 2DUP 2OVER 2SWAP : ; < <# = > >BODY >IN >NUMBER >R ?DUP
;; @ ABORT ABORT" ABS ACCEPT ALIGN ALIGNED ALLOT AND BASE BEGIN BL C! C,
;; C@ CELL+ CELLS CHAR CHAR+ CHARS CONSTANT COUNT CR CREATE DECIMAL DEPTH
;; DO DOES> DROP DUP ELSE EMIT ENVIRONMENT? EVALUATE EXECUTE EXIT FILL
;; FIND FM/MOD HERE HOLD I IF IMMEDIATE INVERT J KEY LEAVE LITERAL LOOP
;; LSHIFT M* MAX MIN MOD MOVE NEGATE OR OVER POSTPONE QUIT R> R@ RECURSE
;; REPEAT ROT RSHIFT S" S>D SIGN SM/REM SOURCE SPACE SPACES STATE SWAP
;; THEN TYPE U. U< UM* UM/MOD UNLOOP UNTIL VARIABLE WHILE WORD XOR [ [']
;; [CHAR] ]
;; The problem with implementing this in a way that it can be
;; simulated on the host and moved to the target lies in 3 parts:
;; * INPUT: ACCEPT
;; * DICTIONARY: FIND WORD VARIABLE CONSTANT CREATE POSTPONE
;; * THREADING: