New Micros, Inc  

Go Back   New Micros, Inc > Software Technical Support > FORTH ONLY
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 01-20-06, 06:09 AM
tichy tichy is offline
Registered User
 
Posts: 37
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
Reply With Quote
  #2  
Old 01-20-06, 09:20 AM
RMDumse RMDumse is offline
Moderator
 
Posts: 1,359
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is On
Forum Jump



All times are GMT -5. The time now is 04:23 PM.


Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.