Thu May 15 12:02:03 CEST 2008
: bla 1 2 3 ;
but what about
: 123 1 2 3 ;
where '123' is the address?
the problem is, code outside of a definition is no longer
allowed. the only way parameters can be passed to the assembler is
through instructions inside a target-word instance. maybe the same
route should be followed as for variables? add some pseudo asm..
let's go to the root problem:
* allow creation of words/macros from within macros
* allow setting of address of these words
fuck i'm doing language design again..
actually, it's not so bad.. the trick is to make 'org' operate on the
current label. the code to compile a jump at a certain location then
` VEC label \ create new label
#x200 >org \ set current label's org
do-vec exit \ compile its code
org> drop \ restore org
looks like it's working.. the idea: to allow creation of WORDS within
MACROS. note that to create macros within macros a different mechanism
is necessary: introduction of names needs to be done on the Scheme
macro level, so words created as such are not accessible to the bulk
of the code by name.
it's still not optimal.. it gets in the way of straight-line
code.. maybe i should add this concept:
code that comes from the compiler needs to be assembled in straight
line, but the compiler can ask to dump some code somewhere else too.
this should make anonymous code possible too.. argh
maybe this is good enough: the only place where it will get in the way
is re-arranging of code locations by the assembler (or intermediate
step). i.e. the connect-words! function in target-compile.ss won't work.
the real problem is: whenever an org-pop happens, compilation can
continue at the word where the corresponding org-push happened. this
might be a clue about how to implement. the compiler doesn't need to
provide a list of words, but a list of list of words, where the
inner lists have fall-through, and the outer ones are independent.