Jeff wrote: > > 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 <[EMAIL PROTECTED]>
The previously-submitted version will be mangled by many mailers. As I don't have a handy website to place this on, I'll let you access it through CVS in languages/forth, probably where it should have gone in the first place. In addition, the CVS version is an improved version of the original code, using a proper jump table within a PerlHash. -- Jeff <[EMAIL PROTECTED]>
forth.gz
Description: GNU Zip compressed data