From: Kalus M. <mic...@on...> - 2009-03-31 20:29:58
|
Hi Erich. Its more like "keep it simple". Tiny microprocessor forth systems usualy dont abort unstructured code. For example in fig forth or Rockwell AIM65 Forth the ;s just returned, no error checking at all: aim65: code: ;S ( IP <-- RP ) PLA STA 9F PLA STA A0 JMP NEXT fig forth entsprechend, zB. 8086: code: ;S MOV SI,[BP] ( IP <-- R1 ) INC BP INC BP JMP NEXT And amforth does not check for it too: : ';' compile exit [ ; Big Forth systems do abort compilation if code ist unstructured. This is done by setting local variables which are checked by ; finaly. Use depth of stack as a minor check. If stack depth has changed after compilation of a word look twice what was done there. So if you find a bad definition, enclose it in DEPTH and if it does not read 0 1 like in depth : test 1 2 3 . . . ; depth .s <2> 0 1 ok revise code. Michael Am 31.03.2009 um 20:56 schrieb Erich Waelde: > Hello, > > amforth, rev.736 (3.4) > > > amforth 3.4 ATmega32 ok > > : test1 0= if -1 ( no then ) ; > ok > > : test2 0= if -1 else 0 ( no then ) ; > ok > > 1 test1 . > --- hangs here until reset --- > amforth 3.4 ATmega32 > > 1 test2 . > ?? -13 8 > > > > if statements missing the trailing "then" will compile > without the compiler barking. I consider this a bug. > > calling such a word will produce a "hang" in one case. > This can be viewed as another bug, but that is not > important. In the other case it is producing an > error message at least. > > Cheers, > Erich > |