Closed mitra42 closed 3 years ago
This is hard lets take two (artifiically simple) examples.
: VARIABLE CREATE 1 CELLS ALLOT ; VARIABLE foo
: CONSTANT CREATE , DOES> @ ; 10 CONSTANT ten
code
) on the stack.10
off the stack and compiles into the code
This isn't so hard if direct code is being used, a call to the "CREATE" routine is replaced with a call to the DOES> code, but with indirect or token threaded code the problem is where to specifiy where that code is.
I see two possibilities a: For each DOES> create a new function which encapsulates the address of the DOES in the function, store it in jsFunctions.
The con for this is that the number of jsFunctions grows with each defining word and that we have addresses of dictionary appearing in Javascript functions.
b: Have create always compile two cells, the first being a token for CREATE and second being the address (xt) of the definition.
So the definition : VARIABLE CREATE 1 CELLS ALLOT
becomes identical to : VARIABLE CREATE 1 CELLS ALLOT DOES> ;
I'm going to go with that 2nd definition even though it breaks with the eForth model, (which is strangely missing DOES>
)
Above is working - still need to do Vocabulary