![]() |
|
#1
|
|||
|
|||
|
MaxForth behaviour
If MaxForth gets an unknow word, i.e. NotHere, is it correct that the data stack is completely deleted after that?
---- NotHere NotHere ? .S EMPTY OK |
|
#2
|
|||
|
|||
|
Yes, that is correct.
In Forth, everything typed in is either a word or a number. Or a mistake. (There are minor exceptions to this, there might be strings, but strings are the responsibility of the word using them. Like : which has a name string following it. But if a string isn't taken by the word, it too is a mistake to Forth.) So what happens, is QUERY collects a line, INTERPRET parses the line and interprets parsed word after word. If the word isn't found, it tries to make a number out of it. If it isn't a valid number, Forth assumes something has gone wrong, and calls QUIT which calls ABORT. Those words clean up the stacks before returning to the QUERY INTERPRET loop. So yes, going through ABORT all the stacks are cleaned on an error. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|