gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Re: arch roadmap 1 (and "what's tom up to")


From: Samuel Tardieu
Subject: Re: [Gnu-arch-users] Re: arch roadmap 1 (and "what's tom up to")
Date: Tue, 29 Jun 2004 18:04:25 +0200
User-agent: Mutt/1.5.6i

On 29/06, Tom Lord wrote:

| What would you have different there, and why?   Should the reader 
| have an option so that the lexeme "123" produces something other
| than an exact integer?   What, and why?   Should there be a global
| hook that allows you to replace the self-pushing nature of _all_
| numbers to be something else?   I have trouble imagining a clean use
| for that feature and fear that it's run-time expense would outweight
| any benefits it might have.

My view is biased because I write Forth cross compilers for robotics.
When you write a cross compiler in Forth, you redefine ":" and ";" so
that they create words for the target in a special vocabulary. For
example,

  : foo bar ;

will define a "foo" word for the target which calls the target word "bar",
because it will use the ":" and ";" defined  by the meta compiler. You can
do that my using the default outer interpreter.

However, if you do

  : foo 2 ;

you have a problem, as the right ":" and ";" will be picked but "2" will
get pushed on the stack instead of being viewed as "generate code for
the target to put 2 on the stack at runtime". One alternative is to use
things such as

  : foo 2 const, ;

where "const," takes a word on the compiler data stack and generate the
appropriate code for the target. The other alternative is to rewrite a
new outer interpreter which handles integers specially.

If you want your Furth language to be a general purpose one, it would
be great to vectorize some things such as Forth's ">number" in your
outer interpreter. Vectorization doesn't necessarily cause a big
performance hit.

  Sam





reply via email to

[Prev in Thread] Current Thread [Next in Thread]