From: rich Date: Fri, 28 Sep 2007 19:39:21 +0000 (+0000) Subject: Fix last EXIT in SEE X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=e8aaec0eb1676422d1cda0338405c0cae8bd42a7;p=rrq%2Fjonesforth.git Fix last EXIT in SEE --- diff --git a/jonesforth.S b/jonesforth.S index be0420a..b7990e8 100644 --- a/jonesforth.S +++ b/jonesforth.S @@ -1,11 +1,11 @@ /* A sometimes minimal FORTH compiler and tutorial for Linux / i386 systems. -*- asm -*- By Richard W.M. Jones http://annexia.org/forth This is PUBLIC DOMAIN (see public domain release statement below). - $Id: jonesforth.S,v 1.37 2007-09-28 18:55:10 rich Exp $ + $Id: jonesforth.S,v 1.38 2007-09-28 19:39:21 rich Exp $ gcc -m32 -nostdlib -static -Wl,-Ttext,0 -o jonesforth jonesforth.S */ - .set JONES_VERSION,37 + .set JONES_VERSION,38 /* INTRODUCTION ---------------------------------------------------------------------- diff --git a/jonesforth.f b/jonesforth.f index 3a7612e..b2cf98a 100644 --- a/jonesforth.f +++ b/jonesforth.f @@ -2,7 +2,7 @@ \ A sometimes minimal FORTH compiler and tutorial for Linux / i386 systems. -*- asm -*- \ By Richard W.M. Jones http://annexia.org/forth \ This is PUBLIC DOMAIN (see public domain release statement below). -\ $Id: jonesforth.f,v 1.7 2007-09-28 18:55:10 rich Exp $ +\ $Id: jonesforth.f,v 1.8 2007-09-28 19:39:21 rich Exp $ \ \ The first part of this tutorial is in jonesforth.S. Get if from http://annexia.org/forth \ @@ -1013,7 +1013,6 @@ >DFA ( get the data address, ie. points after DOCOL | end-of-word start-of-data ) ( now we start decompiling until we hit the end of the word ) - ( XXX we should ignore the final codeword if it is EXIT ) BEGIN ( end start ) 2DUP > WHILE @@ -1051,6 +1050,16 @@ CFA> ( and force it to be printed as a dictionary entry ) ID. SPACE ENDOF + ' EXIT OF ( is it EXIT? ) + ( We expect the last word to be EXIT, and if it is then we don't print it + because EXIT is normally implied by ;. EXIT can also appear in the middle + of words, and then it needs to be printed. ) + 2DUP ( end start end start ) + 4 + ( end start end start+4 ) + <> IF ( end start | we're not at the end ) + ." EXIT " + THEN + ENDOF ( default case: ) DUP ( in the default case we always need to DUP before using ) CFA> ( look up the codeword to get the dictionary entry )