Embedding & Extending Python &other scripting languages

T

Tommy Nordgren

I'm interested in doing a rather ambitious project concerning compiler
construction tools.
My tools will parse specification files containing for example lalr
parser specifications.
The specifications will contain embedded semantic actions which i want to
allow writing in any object-oriented language.
The specifications will name a scripting language and a target language
module . Then my tool will create an embedded interpreter for the
scripting language, which will load a target language module written in
the scripting language, and use it to generate code in the target
language.

I want to provide my system as open source.

Now my basic problem is how to find what scripting languages are
installed on a users system, and generate the necessary makefiles
automatically. I will be using swig for interface creation.
I want to support at least perl and python, with target language support
for at least java and c++ initially.

I probably want to support codegenerators written in ruby and tcl as
well.

Any help would be appreciated.

I prefer email replies to <[email protected]>


Stockholm, April 21, 2005
Tommy Nordgren
 
M

Maurice LING

Hi Tommy,

After reading what you've written, it is still very vague for me. Is it
a program that reads a specification and outputs the corresponding codes
in the langauge you want?

Cheers
Maurice
 
M

Mike Meyer

Tommy Nordgren said:
I'm interested in doing a rather ambitious project concerning compiler
construction tools.
My tools will parse specification files containing for example lalr
parser specifications.
The specifications will contain embedded semantic actions which i want to
allow writing in any object-oriented language.
The specifications will name a scripting language and a target language
module . Then my tool will create an embedded interpreter for the
scripting language, which will load a target language module written in
the scripting language, and use it to generate code in the target
language.

I want to provide my system as open source.

Now my basic problem is how to find what scripting languages are
installed on a users system, and generate the necessary makefiles
automatically. I will be using swig for interface creation.
I want to support at least perl and python, with target language support
for at least java and c++ initially.

Ouch. Nasty problem. You can find out what scripting languages are
installed on a Unixish system by doing "which <name>" in a shell
script. "<name>" varies depending on the language in question. I.e.:

guru% which python
/usr/opt/bin/python
guru% which ruby
/usr/opt/bin/ruby
guru% which perl
/usr/opt/bin/perl
guru% which tclsh
/usr/opt/bin/tclsh

for python, ruby, perl and tcl.

For Windows, you can probably grovel similar information out of the
Registry. I'll leave details up to someone unfortunate enough to have
to work with Windows.

FWIW, you probably ought to verify that java and C++ are installed as
well. End-users systems - specifically Windows, but some Linux/Unix
distributions don't include either.

Finally, checking just that just interpreter exists may not be
sufficient for all Unix-like systems. Some systems, for various
nonsensical reasons, split packages up into two halves. One half will
install the interpreter, and the other half will install the include
files and etc. that you need to build extensions. You may need those
as well.

<mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top