[EMAIL PROTECTED] wrote:

> > > Compiling the compiler into the runtime? Compilers can be small..
> >
> > Even if it has to be smart enough to compile REBOL?
> 
> IF Rebol would be properly modularized, e.g. much earlier discussion about one and 
>only
> /Core.exe, others as loadable components, or just ability to 'package appropriate 
>components into
> one .exe, even compiler could be separate component, no?

You can't know what the input to compile will be, so you'll have
to include everything.

> > Would that really be faster than the current interpreter? Just a
> > bit, I think. Is that worth the effort?
> 
> Huh, just only a bit?

Yup. The compiler doesn't know that IF means if, does it?

> > But then again you need the compiler in the runtime; I have dubts
> > that such a "REBOL compiler" could be dramatically faster than the
> > current interpreter. If you, instead, express the speed critical
> > parts with an ad hoc designed compilable dialect, and then compile
> > those, you get a dramatic speed improvement with just a little
> > effort.
> 
> sounds interesting, is it achievable? What would such "dialect" look like, what 
>exactly should be
> its purpose? Could you explain a little bit, please?

Imagine you have the ability to MAKE NATIVE! passing a binary
containing the (relocatable) machine code. You can easily write a
compiler in REBOL that takes some language (even C) and translates
it to machine code. Something like:

  my-native: make native! compile {
    for (int i=1; i<=10; i++) {
      sum += i;
    }
  }

(Let's ignore argument passing etc.). Or you could use a REBOL
dialect:

  my-native: make native! compile [start [integer!] end [integer!]
/local sum [integer!]] [
    for i 1 10 1 [
      sum += i
    ]
    return sum
  ]

For platform independency, you'd need to compile to some form of
bytecode.

Also, the compiler could be native in REBOL, so you'd be able to
write:

   my-native: make native! [...] [...]

etc.

Regards,
   Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

Reply via email to