Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

FORTH

Name: Anonymous 2014-04-13 0:49

Does anyone here program in FORTH?

Name: Anonymous 2014-06-03 22:44

A typical FORTH word definition begins with a comment showing the state of the stack before and after the execution of the word:

\ Duplicates x on the stack
: dup ( x -- x x ) definition-goes-here ;

\ Stores n at address addr
: ! ( n addr -- ) definition-goes-here ;


Does anyone know if the top of the stack is supposed to be on the left or the right (eg which of n or addr is supposed to be on the top)? For some reason, every goddamned tutorial I've read acts like this is obvious and never says so explicitly. I can think of good reasons for both: Left-to-right looks more like a function declaration in other language, while right-to-left matches the way that stacks are usually displays when printing (bottom-most element on the left, top-most on the right).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List