name mangling (name projection, name mapping) defines how a string of letters (word) is interpreted, depending on the mode, and depending on the suffix of the read word, and the words in the dictionary. in host compile mode, we have the following equivalent semantics WORD, "targetpostpone WORD" == compile target macro WORD, / compile postponed WORD WORD_ "hostpostpone WORD" == compile host macro WORD_ / compile postponed WORD WORD# "compile target interpret semantics" != "perform target compilation semantics" so, in plain english XXX, either compiles a call to a target macro named XXX, or compiles compilation code for the target word XXX XXX_ does the same for host macro/words XXX# compiles target execute semantics if XXX is a target word (remote call), or compiles the target override command XXX# these things could be implemented with decently defined semantics structures (i'm working on a branch which has this to see the difference) but are currently defined using name mangling (mapping). 00 literal match 0_ specialization 0, 0% _0 global access #0 the complete mangling table: mode i d t semantics HC 0 0 H compile host word 0 _ H execute host macro _ 0 H compile target word compiler (host postpone) # 0 T compile remote call , 0 T compile target word compiler (target postpone) host literal TC 0 0 T target compile 0 , H execute target macro target literal MC 0 0 T target postpone 0 % H execute macro immediate 0 , H compile target macro target postpone literal HI 0 0 H host execute # 0 T remote target execute load number TI 0 0 T remote target execute 0 # H target command execute (override) 0 0 H host execute (Fallthrough) load number MI 0 0 H execute host word 0 # H execute host word 0 % H execute host word mangling can be further specified as 1 bit: HOST/TARGET 1 bit: in/out [quote/expand] n bits: mangling char " #,_%" question is, can HOST/TARGET attribute be eliminated? target words can be: compiled, postponed, remote executed and postponed remote executed TODO: edit below name mangling again ------------------- currently we use a very dirty 'name projection' or 'name mangling' hack for word semantics. it's consise, and straightforward to understand, but quite hard to handle for some things since there is no clear distinction of semantics: everything is implicitly defined according to 'visibility'. i.e. lit, is a host word requiring an argument, but also is visible as lit int the target mode. how do we solve this without loosing the straight-line dictionary? i.e.: i don't like the run-time switching of dictionary priorities, because it messes up 'mark' and 'empty'. but there is a way to clearly define semantics of a word, and have the parser map everything to this clean internal representation. so, what's the different kinds of words we have: HOST ' ' host words HOST '_' host macros TARGET ' ' target words HOST ',' target macros HOST '#' target interpret words, overriding host words HOST '%' macro immediate words, overriding target macros what about dictionary with dictionary flags, and modes enabling/disabling the flags? the thing we need is access from each of these things from within the host environment. can this be done in the same way, but using a better dictionary representation? i.e.: : dosomething word, ; word, either compiles a target macro, or postpones a target word. : dosomethingelse_ word,_ ; word,_ pospones a target macro, or double postpones a target word so , means 'target postpone' _ means 'host postpone' different mappings: interpret/compile (mode state word -> match + interpret action) define mode word -> name attribute i tried a 8-mode interpreter, which seems to work OK but can be hard to understand. it also changes much of the code, since it's not 100% equivalent to the name mangling.