«« «» »» |
----- Example session -----
Bold text is input, plain text is the program's reaction. [rtn] is the return key. NOTE: THE ACTIONS FORTH NORMALLY TAKES AFTER AN ERROR WILL BE SUPPRESSED. EX [rtn] 0: [ DROP [rtn] -4 THROW executes 0: [ 12 [rtn] 1: 12 [ 1999 [rtn] 2: 12 1999 [ : ZWAP [rtn] 2: 12 1999 ] QWERTY [rtn] -61 THROW executesEVALUATE can't grok QWERTY -- this is neither a word nor a number. However, compile-state is kept intact, as is the stack. 2: 12 1999 ] 2>R [rtn] 2: 12 1999 ] R> R> [rtn] 2: 12 1999 ] ; [rtn]Notwithstanding the error, ZWAP seems to have been compiled. 2: 12 1999 [ ZWAP [rtn] 2: 1999 12 [ ' ASDF [rtn] -13 THROW executesTICK can't find ASDF. 2: 1999 12 [ -56 THROW [rtn] [rtn] ok .S [rtn] ( 1999 12 ) okEX enters an infinite loop which you only can break out of by using QUIT or BYE. Of course BYE is inappropriate. -56 throw is a special THROW that executes QUIT. Also try ABORT and TRUE ABORT" Hello!" ABORT should execute -1 THROW. Some Forths allow ABORT" in interpretation state and execute -2 THROW. |