develooper Front page | perl.perl6.internals | Postings from June 2002

New Language...

Thread Next
From:
Jeff
Date:
June 21, 2002 19:34
Subject:
New Language...
Message ID:
3D13E03B.5B721F83@hargray.com
For your edification/amusement/nightmares...

A FORTH interpreter.

Doesn't do much, but it -will- compile words. It accepts the following
input:

> 3 : square ( n -- n ) dup * ; : cube ( n -- n )
square> dup square * ;
cube> .
27>

I'll be adding new words as the fancy strikes me. As you can see by the
sample code (or maybe not), it accepts simple words, can handle simple
comments, and even compile words involving multiple-word expansions.

Aside from being a cute example of YA language, it -does- serve the
purpose of testing PerlHashes and the integer stack. I was intending to
let the core split words into a PerlArray, but the simpler architecture
handling one word at a time worked out better, and obviated the need for
a split()-like routine.
--
Jeff <jgoff@perl.org>
Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About