This is the mail archive of the guile@sourceware.cygnus.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: Translators again (Re: Python transformer for Guile?)


Suggestions:

Just as you say, a translator module is an ordinary module but with a
specific translator API.  Through this interface, the translator
specifies, among other things, the name of the language, <langname>,
and a regexp <langmatch> matching filenames of source written in the
language (a la Emacs auto-mode-alist).

There are now three ways of executing code of this language:

1. Specifying the language with the option -L<langname> on the Guile
   command line.

This can be used when writing scripts in the language:

#!/usr/bin/guile -Lpython -s
#!

(I hope it is possible to support multiple options to Guile scripts in
 a portable way.  In any case, it seems to be feasible on Linux
 systems.  Does anyone have a clue?)

2. Loading individual files.

`load' (or `generic-load' if we want to be strictly R5RS) will choose
language the same way as Emacs chooses language mode.  It uses
<langmatch> or some specific key string found in some commentary at
the top of the file.  An application can call scm_generic_load from C.

3. Writing modules in the language.

If the new module system allows for separation between module
specification and source of the module (a la Scheme48), we can write
the module header in a file using scheme syntax.  In this header both
source file and language are specified.

Lalo Martins <lalo@webcom.com> writes:

> >    about the license.  Also, I started a fairly rough hack
> >    aimed at using the flex/bison parsers but with Scheme level
> >    specifiable tables some time ago.  I'll gladly give you what I
> >    have.)
> 
> I firmly believe this is the best approach for most
> translators. Of course if you can rip the original parser (as
> seems to be the case with python) it will usually be better;
> but for writing from scratch I'd go with your approach.

It would be wonderful if you could carry this through.  Now I have to
check, though:  I have a vague memory that Jost B. and Richard Polton
both were interested in working on this.

Did I send you my source, Jost?

Are you still interested?

Maybe you could talk between eachother who is going to do what.

In any case, I'll send you what I have, but not until Friday 28/1 or
so.

Best regards,
/mdj

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