2022-08-18 17:59:23 I think it's very hard when you have something wrong and the stack ends with garbage to track where it started leaving garbage, it's likely no error would happen more than a stack underflow, so do you have any way to check this kind of stuff? 2022-08-18 18:00:02 did you ever find youself with garbage in the stack? 2022-08-18 18:00:07 yourself* 2022-08-18 18:01:32 I'm not having this problem now, but I just want to know if there's any hint or if you do something when this happens 2022-08-18 18:02:30 and maybe you don't even find it's a hard problem at all 2022-08-18 18:06:10 what would you do if you find the program ends with garbage in the stack, but seems to work fine? 2022-08-18 18:11:51 also there are any "traps" common to Forth that I could be aware of? like common problems I might have because of the nature of the language 2022-08-18 18:52:29 vms14: in my FORTH program experience so far, if you end up with garbage on the stack, it is often some extra data that you forgot to drop during loop itterations, which usually is easy to find in your code 2022-08-18 18:53:42 so a loop is the first place I should look for 2022-08-18 18:54:29 personally, I rarely have trouble with garbage left on the stack. The bugs I usually deal with are when the word is handling the stack correctly, but not producing the side effects you intended 2022-08-18 18:54:58 like, your word is suppose to program some register, or generate a signal on a line, and it doesn't 2022-08-18 18:55:50 I find it is usually simplest just to walk through your word one word at a time, entering the commands at the interpreter, and checking the stack occasionally to see if data is getting manipulated in the way you expect 2022-08-18 18:56:08 thanks for the hints, I wanted to know if there's something I could implement to avoid this or to help tracking the stack, because in a "large" program it seems hard to me to track it when something goes wrong 2022-08-18 18:56:52 writing too much without tests is a great way to make bugs 2022-08-18 18:57:13 also I have 0 error checking, only the stack underflow message and when an error happens in the host language I show the last word being executed, but it's not very helpful anyways 2022-08-18 18:57:40 it's an interpreter written in perl and another in js, it's quite different to Forth 2022-08-18 18:58:39 I've taken only the concepts of a stack, the rpn and "everything is a word", everything else is different, althougth words can now read from the source code like the Forth ones