[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
language translator help
From: |
John W. Eaton |
Subject: |
language translator help |
Date: |
Fri, 26 Apr 2002 12:55:10 -0500 |
Although there has been much inactivity in the year or so since I
first asked this list for comments about the possibility of some kind
of Guile/Octave merger, I've not given up.
Right now, my ideas are that I would eventually modify Octave's parser
to emit Guile code, and then pass that off to Guile to interpret. My
reasons for wanting to do this include
* improving the performance of Octave's interpreter
* immediately gaining some functionality that would otherwise be hard
to get (object-oriented programming with goops, an interface to
external packages like gtk, etc.)
* allowing me to avoid having to maintain yet another scripting
language interpreter (though it remains to be seen whether a
translator will be any simpler than the current interpreter).
Obviously, making the new system fully functional would require not
only writing the translator, but also creating a run-time library of
Octave primitives that could be called from Guile.
As I see it, adapting Octave's core functions (the stuff written in C,
C++, and Fortran) for use with Guile is a big job, but one that is
certainly possible. Even just having that capability inside of Guile
would probably be quite useful to some. For the Octave users who are
more comfortable programming in Octave rather than Scheme (and this
includes me, at least currently), having the translator is essential.
Before jumping in and doing a lot of coding, I'm trying to get a
clearer idea about how the translation would work. Some questions:
* Is it a good idea for the translator to parse Octave code and emit
Scheme code as strings that are then reinterpreted by Guile? Is
there a better way of doing that? My guess is that this is OK, and
the overhead of parsing twice is not so important.
* I originally thought that translating the syntax would be trivial,
but now I find that I'm really quite clueless when it comes right
down to doing this part.
For example, Octave has C-like break and continue statements for
breaking out of or jumping to the end of a loop. What is a
reasonable way to translate them to Scheme? I came up with a way
to handle both, but they involve call/cc and seem much more
complicated than the corresponding Octave code. I'm left thinking
that there must be a better way. However, solutions that
completely rewrite the structure of the loop are not so interesting
to me unless there is a way to do that in a way that doesn't
require the translator to do a lot of analysis of the incoming code.
Can anyone offer some clues about these kinds of translation
problems? Failing that, is there a "Scheme for C Programming
Dummies" kind of document somewhere?
* If syntax can trip me up, I know semantics will too. For example,
it's not clear to me how to handle the differences in Octave and
Scheme scoping rules for variables.
Any pointers or discussion (public or private) would be most
appreciated.
Thanks,
jwe
--
www.octave.org | Unfortunately we were hoplessly optimistic in 1954
www.che.wisc.edu/~jwe | about the problems of debugging FORTRAN programs.
| -- J. Backus
- language translator help,
John W. Eaton <=
- Re: language translator help, Thomas Bushnell, BSG, 2002/04/26
- Re: language translator help, Neil Jerram, 2002/04/27
- Re: language translator help, John W. Eaton, 2002/04/27
- Re: language translator help, Thomas Bushnell, BSG, 2002/04/27
- Re: language translator help, John W. Eaton, 2002/04/27
- Re: language translator help, Thomas Bushnell, BSG, 2002/04/27
- Re: language translator help, John W. Eaton, 2002/04/28
- Re: language translator help, Thomas Bushnell, BSG, 2002/04/28
- Re: language translator help, John W. Eaton, 2002/04/28
- Re: language translator help, Thomas Bushnell, BSG, 2002/04/29