read/write on parse tree program representation (RE: Languages and AI)

From: Ben Houston (ben@exocortex.org)
Date: Fri Jul 20 2001 - 16:38:59 MDT


You're not going to like my response.

>Really? Fine. I want to be able to access the PARSED source code, not
>the plaintext, from inside the program. Furthermore, I want to be able to
>alter the parsed source code, represented in a natural way (i.e., an
>expression is a tree and not a series of machine instructions). I want to
>be able to annotate any element in this tree, whether a branch or a leaf,
>with complex data structures of my own devising, including new data types
>of my own devising, without destroying the integrity of the existing data
>or preventing the code from executing. Any existing languages got that
>feature, which is simply first on the list?

You can add this feature to Java with a little work.

Basically you would need into integrate a Java decompiler and a Java
compiler into your program so that it can decompile and compile you programs
at run-time but that shouldn't be too hard - there are a lot of open source
Java decompilers and compilers. Without any changes to the Java compiler
you might lose the names of the non-exposed variables and functions but I
think that if you have control of the Java compiler you can keep them.
You'll probably want to turn off all the optimizations that the compiler can
do in order that the decompiled code looks like the original code.

How to implement this programmatically? I would suggest a "function lock"
or an "object lock" mechanisms kind to how one locks memory in a shared
memory system (although you could get the parse tree without locking it,
locking is only required for modifying it). During the time it is locked if
one tries to execute it an exception will be thrown. Soon as you unlock a
function or object it will be re-compiled. This would require a little
modification of the VM but not a huge amount. Java with it's introspection
capabilities already supports querying for an Objects exposed functions or
variables, this is just an extension to that.

I suspect that you can do this modification to C# as well but I am not
totally sure about that yet. They might have more protection against
de-compilers that Java did.

Cheers,
-ben houston
http://www.exocortex.org

-----Original Message-----
From: owner-sl4@sysopmind.com [mailto:owner-sl4@sysopmind.com]On Behalf Of
Eliezer S. Yudkowsky
Sent: Friday, July 20, 2001 5:58 PM
To: sl4@sysopmind.com
Subject: Re: Languages and AI

Ben Houston wrote:
>
> Hi Eliezer,
>
> I'd strongly recommend against creating a language. It will take way too
> much work and more probably will never get done. Also I have not yet seen
> any new features that are really driving you towards a new language.

Thanks for all the well-meant naysaying (he said, seething quietly), but I
know what I need and why, from several years' worth of wishing in routine
programming (not just for AI), and it can be done inside a programming
language that will benefit the community at large and not just SIAI. The
programming language will be forked off as a separate open-source project
that will rendezvous with the AI side when it reaches production quality
or becomes so cool that it's worth using the beta.

Flare really is an entirely different kettle of fish, and no, I CAN'T live
without it. Some things in Flare are cool, but other things are things
that we can either do poorly in Python (or, heaven help us, C++) on our
lonesome, or do elegantly in Flare with the support of the open-source
community. There's a section of the language space that we need to
explore, and Flare is the first, fundamental step into that language
space, the step that makes it possible for us to take the next steps.

> Describe the feature that you want and I'll bet that I can find an
existing
> language that has that feature.

Really? Fine. I want to be able to access the PARSED source code, not
the plaintext, from inside the program. Furthermore, I want to be able to
alter the parsed source code, represented in a natural way (i.e., an
expression is a tree and not a series of machine instructions). I want to
be able to annotate any element in this tree, whether a branch or a leaf,
with complex data structures of my own devising, including new data types
of my own devising, without destroying the integrity of the existing data
or preventing the code from executing. Any existing languages got that
feature, which is simply first on the list?

-- -- -- -- --
Eliezer S. Yudkowsky http://intelligence.org/
Research Fellow, Singularity Institute for Artificial Intelligence



This archive was generated by hypermail 2.1.5 : Wed Jul 17 2013 - 04:00:36 MDT