[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave Compiler
Re: Octave Compiler
Wed, 11 Feb 2004 17:26:57 -0800
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007
I've looked (and done) a little bit of work in this same direction.
Are you talking about writing an actual compiler, or an Octave to C++
code generator? In the case of the latter, you might consider
integrating the code generator into the main Octave source. That said,
when developing a new, semi-large addition to this source tree,
recompilation is a bit cumbersome, so, what I have taken to doing is
developing via ".oct" files. This should give you access to all of the
Octave internals, while allowing you to only recompile your source
code. (Take note that there are a few gotcha's in developing this way, I
recall having some trouble when I wanted to check if a symbol was a
function or not.)
Since you're probably going to start with parsing, you should
familiarize yourself with the parse-tree structures, base class is
"tree" and tree walking stuff, base class "tree_walker", found in "pt.h"
and "pt-walk.h", respectively. The tree_walker class allows you to visit
each node in the parse tree in an ordered fashion. I will attach the bit
of code which I started. The code is basically what you find in
pt-pr-code.cc, with a few additions so I can see what goes where. You
should be able to just do a 'make' to produce 'compile.oct" and then,
using the example 'mysum.m', start up octave and 'compile('mysum')', it
should produce just a simple template and then some debug information.
(The code worked as of Octave version 2.1.45, but I haven't tried it
with new versions yet.) If you're going to compile it, you'll also want
to remove any references to "parallel" in pt-emit-cplusplus, these are
additions I've made to try to give Octave some parallel support.
I'd be happy to work with you on this project, if you're so
inclined, or, at the very least, pass on the other tidbits I'd been
thinking about with respect to octave to c++ converter. That will just
take a little revival.
There are two quite interesting alternatives to converting to C++
that I had been kicking around. One was creating a Just-In-Time compiler
for Octave. The other is actually writing a front end for gcc to compile
directly to binary from octave code. While the former could potentially
provide a good performance increase for the standard Octave user, the
latter may not be relevant, it just sounds like a cool project to me.
There is plenty of literature on the JIT compiler in regards to Matlab.
Hope this helps,
Jens Ruecknagel wrote:
To whom in concerns,
As a student research project I want to develop an Octave to C++
My name is Jens Ruecknagel. I am a student at Technical University of
Ilmenau, Germany in the course computer science in my 4th and final
year. After finishing my degree I am going to be am diploma computer
scientist (comparable to a master degree). I already have some
experience in developing programming languages.
I am trying to adapt the Lex/Yacc grammar of Octave to fit the needs
of an Octave to C++ compiler. And I am developing a backend to
generate C++ code.
I am just starting to work on this project, therefore I am still
“reading” the Octave code to find out which parts of the Octave
project I can use.
I think, I can use the Lex/Yacc parser which (I suppose) constructs an
abstract syntax tree which then will be feed to the my compilers backend.
I’m still thinking about which numerical libs the generated code shall
depend on – I’ll probably use liboctave first and maybe replace it later.
So I hope you answer some questions about Octave:
Do you have any additional documentation on the Octave source code?
On which Octave version should the compiler be based on? I was
thinking I use 2.1.50.
Can you give me some hints about my task?
May I bother you again, if I run into problems? (I am sure there will
be some problems :-))
Tanks a lot,
Description: GNU Zip compressed data
Re: Octave Compiler, Przemek Klosowski, 2004/02/18
- Octave Compiler, Jens Ruecknagel, 2004/02/09
- Re: Octave Compiler,
JD Cole <=