

The ability to do crash and burn compile/test cycles in a matter of seconds (it takes about 7 seconds to download the absolute largest program into the chip and huge compiles rarely take more than 2 seconds - more often in the hundreds of milliseconds) makes for a very fast turnaround development cycle. I keep a stack of proto-boards handy for rapid prototypes. As long as you remember it is a microcontroller and play within its limits, it's an incredibly nice chip to use. Having 8 identical cores with a completely deterministic instruction cycle makes for a very versatile little chip. Spin is not blazingly fast, but raw PASM is pretty sprightly (50ns instruction cycle). Spin is a nice easy language to get your head around and as an interpreted language, quite efficient with a nice compact bytecode. I should really read that Closures The Forth Way paper already.It does what it does very well. Then, it would call the 'outer function', passing a pointer to the inner function, along with a pointer to the struct. The outermost/calling function would declare a struct (of whatever size) as a local (on the stack), and would populate it. The equivalent in C would be for the 'inner function' to accept a single argument: a pointer to a struct full. : INVOKE_FUNC_THEN_SUBTRACT ( xt subtrahend - n ) >R EXECUTE R> - ġ0 20 ' ADD_THEN_DOUBLE 5 INVOKE_FUNC_THEN_SUBTRACT It doesn't need to be aware of what the 'inner' word/execution-token requires on the stack.

Improved version: the 'outer' word/execution-token is responsible for preparing the stack for when it calls the 'inner' execution-token. This results in the stack holding ( 55 ). : INVOKE_BINARY_FUNC_THEN_SUBTRACT ( subtrahend n1 n2 xt - n ) EXECUTE SWAP - ĥ 10 20 ' ADD_THEN_DOUBLE INVOKE_BINARY_FUNC_THEN_SUBTRACT Here, the 'outer' is aware of the stack-effect signature of the 'inner', which doesn't seem nice. Less horribly, the 'outer' word/execution-token can be responsible for preparing the stack for when it calls the 'inner' execution-token.

This prints 30 35, and leaves the stack holding ( 10 20 ). I had some more thoughts on this stuff, regarding data-management rather than the lifetime of execution-tokens:Ī nasty solution where the 'inner' word/execution-token is aware of how far beneath the top of the stack it needs to look to find its arguments: : EXTRACT_AND_PRINT ( n1 n2 ?1 ?2 - n1 n2 ?1 ?2 ) 3 PICK 3 PICK +. So given that scenario one could compile a bunch of :noname routines in high memory, store the XTs in an execution table some where else and then manage the whole thing as needed.
#PARALLAX PROPELLER II CODE#
This after all, in a simple Forth system, only requires changing the dictionary pointer, compiling the assembler and restoring the dictionary pointer to the old location.Īfter the application code compiled and the assembler was not needed, a clever programmer could remove the Assembler from memory and perform the right magic to remove the dictionary links to the Assembler words in high memory as well.
#PARALLAX PROPELLER II HOW TO#
r/programbattles - Battle it out between likeminded coders to create the best code possible!Īfter re-reading your question here is an old Forth chestnut idea, but you need carnal knowledge of the Forth system you are using, specifically how to link and un-link chunks of the dictionary.Īn old trick that was done in 16 bit systems was to compile the Assembler in upper memory way above where the application code was compiling. r/concatenative - Anything related to the use, theory, or implementation of concatenative programming languages. The Journal of Forth Application and Research Community Thinking Forth - A Language and Philosophy for Solving Problems Starting Forth - A fun, illustrated introduction.Ī Beginner's Guide to Forth - A faster-paced, somewhat less whimsical guide. Forth fits in very small storage spaces.įorth is one of the few environments which is totally comprehensible by one person. Thus, it can become what ever you need it to be and fit the problem like a glove.įorth has a "low floor high ceiling" approach to abstraction - that is, it can be both low level, high level and anywhere in-between. The compiling functionality is an exposed part of the language like everything else.įorth has no baked-in syntax or privileged data structures - programming is done by extending the language to your application. You can try things out interactively as you build your system.
