Download DB006 - GreenArrays
Transcript
DB006 G144A12 polyFORTH Supplement NEXT C( a) Ends a loop that tests the top of the return stack. If nonzero, the value is decremented by 1 and a jump is made to the address given during compilation. If zero, the value is discarded from the return stack and execution continues. 3 FOR I . NEXT displays 3 2 1 0 . 4.3.4 Compiler Internals Active compilers require a few additional functions. Here are relevant compiler control functions: STATE is a USER variable controlling the dictionary search. If 1, we are compiling and the dictionary search checks each IMMEDIATE subvocabulary before it checks the corresponding normal vocabulary. Otherwise it is zero and we ignore the IMMEDIATE subvocabularies. STATE is maintained automatically by the compiler. IMM is a system variable whose value is odd immediately following a dictionary search if an IMMEDIATE word was found. Note that this value may be changed after a PAUSE . IMMEDIATE is used after semicolon to move the most recently created definition to the current IMMEDIATE subvocabulary. compiles a call to the following word even if that word is IMMEDIATE . [COMPILE] (_) \ ( _) is shorthand for [COMPILE] . LITERAL ( n) stack. an IMMEDIATE word that compiles a literal whose value is taken from the compiler's RECURSIVE is an IMMEDIATE word; used inside a definition to un-smudge the name of that definition so it is findable. The following internal functions are useful when extending the compiler; the optimization capability has not proven useful and will probably be deprecated soon: uCODE ( n _) defines a new VM instruction with the value n . It's visible in the regular compiler so that you may name new instructions if you choose to customize the Virtual Machine. -COMPILE sets STATE to zero. ,C compiles a VM instruction and marks it as optimizable. a, compiles an address and marks it not optimizable. -CODE \\ indicates that there is no optimizable instruction. is shorthand for -CODE . Functions present on some polyFORTH systems but omitted here: 2LITERAL 4.3.5 Missing Interpretables In this release, the following primitives are only available in compilation forms. 2+ 26 2- EXECUTE BYTE Copyright© 2010-2011 GreenArrays, Inc. 9/23/12