Forth like interpreter

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Mar 13 20:33:02 EST 2000


"Samuel A. Falvo II" wrote:
> 
> Almost unanimously, they are.  Want to see a great Forth interpretter?  Here
> it is, in x86 assembly:
> 
>         LODSD
>         JMP     EAX

Two instructions? Far too much overhead! On a PDP11
a Forth inner interpreter is just one instruction:

INNER:	JMP	(R5)+

Machine code words end with JMP INNER, and a
threaded word looks like:

myword:	JSR	R5,INNER
	DW	word1
	DW	word2
	DW	word3
	DW	SEMI

SEMI:	MOV	(SP)+,R5
	JMP	INNER

-- 
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-list mailing list