Wednesday, December 12, 2018

Hardly Forth, my second language in a week

Hardly forth simply loads a bunch of stack key words into the Shunt operand table, then runs the Towers of Hanoi model:

PUSH
POP
PULL
EMIT
EXPR

And the punctuation and bracketing operators.

Add the flags, -out -in -oper to specify the proper Tower, the oper Tower being the stack that is internal to Shunt and emptied on completion.. The remote application can set up complex executables, compiled and ready on the args list.   The linux command format, in string, is:

Hardly src;

On the Bus it has two modes, in is already tokenized, or in is a string. Shunt is set up with a mode flag, it can change the args format as need, real time.

Hardly and Default, already ISO defined standards. One is the minimalist imperative language version of the other's stack model, like Love and Marriage, you can't have one without the other.  Shunt takes you through a translation of the one to the other.

Notice, everything in the Shunt code is simply an automatic translation of the wiki page, but one should add functions. I leave them out. Change the operand table, rename it, compile all 100 lines of code to linux ".so" format. Console will find it.  Higher lever syntax engines, especially context specific enterprise dictionaries can use Shun for a variety of script management.

Shunt makes sense because it is one layer above Bus, a simple DMA bus swapping hardware.

No comments: