What I've learned so far...

Massimo Dentico m.dentico@virgilio.it
Mon Mar 24 02:14:01 2003


On Sun, 23 Mar 2003 15:34:34 -0800, Tom Novelli <tom@tunes.org> wrote:

> I stand by my conclusion. C translates directly to Forth, ..

It is evident from your paper that when you write "C translates directly
to  Forth"  you  mean  that  expressions   are  translated  into postfix
notation, so that the   order of  calculations are   clearly determined.
This  is  a  quite  standard technique  in  compiler  theory  (push down
automata).

But this is *not* translating C  into Forth. First, because a C  program
is not constituted *only* by expressions. On the contrary, in large part
is constituted by statements (this  is the typical programming style  in
this language). Second,  equating the Forth  dual stack virtual  machine
with a generic push down automaton is at least inaccurate.

Now, for the real thing, a C to Forth translator: IIRC, MPE Limited have
written such  translator (with  the aim  of porting  C software to stack
processors) but  the results  are not  so good,  not surprisingly.  They
report  that  the quality  of  code produced  by  translation is  surely
inferior than good (highly factored) hand written Forth code.

> .. but some really easy optimizations are done in  the process.  Types make this possible, and infix syntax helps a little also.

Peter Knaggs'  Ph.D. thesis  shows that  is possible  to infer  types of Forth words (sort-of functions, for the reader not familiar with  Forth) and there  are other  papers on  this subject,  even for other languages with an open stack like  Forth (POP-11 and probably Postscript,  I don't remember exactly).

Anyway,   people   like   M.  Anton   Ertl   are   skeptic  about   type
checking/inference.   He   dedicate  his   efforts   to  whole   program
optimizations.

Finally, Forth's inventor, Charles Moore, worth a mention: he is totally
against complex *automatic* optimizations, he is against compilers in  a
certain sense  (to long  to explain  here: his  rational needs  a lot of
context).


> For an  equal  effort, C is  faster.   It's also  easier  to  read and
> maintain.

Asserting  without  verifiable  argumentations does  not  make  you more
authoritative.


> I'm just saying Forth has no place in Tunes.

You are entitled at your opinions, of course, but starting from when can
you  dictate  (and not  simply  suggest and  discuss)  technical matters
regarding this project?


> I won't be drawn into a holy war.

Irrelevant rhetorical trap: this is not  a war, even less "holy". It  is
simply a technical discussion.

Anyway don't worry, we can stop here. I am persuaded more and more every
day that dialectic is useless.

Regards.

--
Massimo Dentico