| ▲ | ajhenrydev 4 days ago |
| Can someone explain for me? |
|
| ▲ | e12e 4 days ago | parent | next [-] |
| A different way to say the same: in forth, words get pushed on the stack, and popped from the stack by words that take arguments: code stack
I Forth love
Forth love I
love I
Forth
; love presumably pops
; subject, object args
; from stack - and does something
; perhaps prints as side effect
|
| |
| ▲ | DonHopkins 4 days ago | parent | next [-] | | Here is some inexplicably but meticulously formatted FORTH code that uses right justified indentation! Including reverse polish notation assembley. https://donhopkins.com/home/code/tomt-cam-forth-scr.txt https://donhopkins.com/home/code/tomt-users-forth-scr.txt ( FMOVE -- functional intersegment move ) HEX
88 CONSTANT *MOV* ( fn = 0 ) 20 CONSTANT *AND* ( fn = 1 )
08 CONSTANT *OR* ( fn = 2 ) 30 CONSTANT *XOR* ( fn = 3 )
CODE FMOVE ( fn s.seg s.off d.seg d.off length --) AX, SI MOV
CX POP DI POP ES POP SI POP DS POP DX POP AX PUSH
AL, # *XOR* MOV DX, # 3 CMP 1$ JE
AL, # *OR* MOV DX, # 2 CMP 1$ JE
AL, # *AND* MOV DX, # 1 CMP 1$ JE
AL, # *MOV* MOV 1$:
CS: HERE 5 + , AL MOV ( modify "[DI], AL MOV" ) 2$:
LODS ES: [DI], AL MOV DI INC 2$ LOOP
AX, CS MOV ES, AX MOV DS, AX MOV SI POP NEXT, END-CODE
-->
| |
| ▲ | forsalebypwner 4 days ago | parent | prev [-] | | Is that loss? | | |
|
|
| ▲ | spott 4 days ago | parent | prev | next [-] |
| Forth I assume uses reverse polish notation: arguments before the operator. 3 4 + for example, would return 7. |
| |
| ▲ | zabzonk 4 days ago | parent | next [-] | | > would return 7 more pedantically, it would push 7 onto the stack | | |
| ▲ | dbcurtis 4 days ago | parent [-] | | even more pedantically, would remove 3 and 4 from the stack before pushing 7 | | |
| |
| ▲ | argimenes 4 days ago | parent | prev [-] | | The stack is really a convenience that makes pipeline-driven programming possible in the language. | | |
| ▲ | nagaiaida 4 days ago | parent [-] | | somewhat relatedly, shell pipelining is very amenable to being massaged into (non stack-based) concatenative programming |
|
|
|
| ▲ | HFguy 4 days ago | parent | prev | next [-] |
| Forth uses RPN so the "verb" is last. That is, you provide the data first (I and Forth) and the command (heart) last. |
| |
|
| ▲ | daureg 4 days ago | parent | prev [-] |
| I found https://www.explainxkcd.com/wiki/index.php/Main_Page quite useful for that. |