OT: Re: D for projects similar to Forth Interpreters?
Daniel Keep
daniel.keep.lists at gmail.com
Sat Feb 28 02:56:03 PST 2009
Tim M wrote:
> PS: any thing unique about forth interpreters compared to other
> interpreted languages?
Forth (actually, postfix languages in general) are awesome fun, and
they're incredibly simple to play with. I made a simple Forth-like
language interpreter in Python to play around with the idea of a
postscript-style language for cairo rendering.
I managed to get it to the point where if and subroutines were
implemented as functions, which I thought was just hilarious. :D
-- Daniel
P.S. Here's an old fib subroutine I made in it. Anything in ( parens )
is a comment.
( Defines a fib word that computes the nth Fibonacci number. )
`fib ( n -- n' ) :
dup 1 <= not
if-then
1-
dup
fib
swap 1- fib
+
end-if
.
More information about the Digitalmars-d
mailing list