Re: Scripting in Gnome

On Tue, 2004-02-03 at 18:44, Maciej Stachowiak wrote:

> All I'm trying to say is: translating arbitrary different programming
> languages is a really hard problem. The only really succesful case we
> have of translating many source languages to one target language is
> compilers translating to machine language. And compilers are very
> complicated and take a long time to do their work. Some of them have
> partially data-driven syntax processing (lex-based scanners and
> yacc-based parsers for instance), but none that I know of have
> data-driven semantics.
> I mean, yes, you can write a program that will take a formal
> description of operational semantics or denotational semantics and
> execute code based on this, but people only write such things as
> research toys. It would take pages and pages just to describe how
> numbers work in real programming languages using denotational
> semantics, and nobody would understand the result.

 Yes and no. Compiler construction is well understood and there are tons
of compiler construction tools around - Yacc Bison Coco/r et al

Bear in mind I am cross compiling into python code not machine code - i
realise the task of creating an interpreter from scratch is hard work
and it would take me years to do it that way. Cross compiling is
relatively easy using a recursive decent parser and is simply a
translation operation rather than low level code generation.

The only problem with using Python is the dependancy issue and that
might prevent my script engine from being adopted by core gnome apps but
thats a compromise I'm going to have to accept.

> So, explaining how you will make translation work by saying "I'll use
> XML" seems like a bit of a non sequitur, and makes it seem like you
> might be underestimating the difficulty of this problem.

Its not that difficult as such. I have used coco/r before (using the
delphi version) and it creates recursive descent parsers with ease.
Coco/r has a nice file layout and my xml file will try and utilise as
much of that layout as possible. Admittedly coco/r is not available on
python though there is something called TGP which I am looking into. If
thats not usable then I can write my own

The real difficulties that I forsee are dealing with quirky language
features like VBA's error handling or GOTO statements and how to
translate them into equivalent python as specified by an xml file.


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