[Top][All Lists]

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

Re: What is Guile?

From: Jonathan Bartlett
Subject: Re: What is Guile?
Date: Mon, 8 Sep 2003 14:39:12 -0700 (PDT)

> I haven't seen much documentation suggesting why guile can
> support other languages better. Has someone written such a
> document? It would go a long way to getting the author of a new
> language to implement his language's interpreter or compiler
> ontop of guile.

The idea comes from Scheme itself - it doesn't really have a syntax.  It's
just a raw parse tree with some primitives.  Using a combination of
function definitions, macro definitions, etc., you can easily modify
scheme to work like any system you want.  Then you just need a parser to
convert the raw code into a parse tree, and have your scheme interpretter
run your parse tree.

Basically, what you would need is the following:

 a) a flag in Guile so that you could specify which parser / language
module to use

 b) the ability to create both macros and definitions within a closed
environment which can be applied to a list (i.e. parse tree - I believe
this is already there)

 c) an interface definition for parsers and language providers.

Basically, the parser would need to be given an environment for a
language, parse the string or input file to a list, and eval that list
within the environment it was passed.

For examples of Scheme used as a syntaxless representation of multiple
languages, see Kamin's "Programming Languages: An INterpretter-Based
Approach" and "Essentials of Programming Languages".  Now, Kamin had to
embed the code for the different languages in the interpretter itself, but
this is doable from scheme itself with macros.


reply via email to

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