This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PHP fork project- Guile vs Python vs ?


"Nic Ferrier" <nferrier@tapsellferrier.co.uk> writes:

> Translators for Guile into other languages have not been completed
> yet but Scheme was chosen (AFAIK) because it is uniquely capable of
> doing this.
> 
> For example, Kawa (a GNU Scheme->Java-bytecode compiler) has
> translators for EMACS Lisp and for ECMAScript (JavaScript). 

However, Kawa does not translate other languages in Scheme.
Instead, Kawa translates other languages into an internal
"abstract syntax tree" representation (similar to what Gcc does),
and thence into Java bytecodes.

This document http://www.gnu.org/software/kawa/internals.html
describes how Kawa works.  (It is a bit out of date, but should
still be of interest.)

> Scheme has an extendable syntax so it is easy to build new constructs
> in the language, for non-LISP like languages one then has to simply
> define a REPL for the language.

But for some languages the semantics are so different from Scheme that
it makes little sense to translate into Scheme.  For example translating
Prolog into Scheme you'd basically end up with Prolog with parentheses:
some pretty strange Scheme, using special syntax forms that the compiler
has to know about anyway if you want decent code.

> The idea is, that when these translators are complete, you will
> program in Guile/Python or Guile/Perl (or whatever) and not notice
> that Scheme is actually doing all the work.

But why?  All it does is add an extra pass to slow down the compiler.
The translated Scheme will in general not be human-reasonable, or
useful for any purpose except as an intermediate language.  In that
case, might as well use an intemediate data structure more suitable
for the compiler, as Kawa does.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]