Bill Allombert on Mon, 08 Mar 2004 15:03:23 +0100


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

Experimenting with a new GP parser/interpretor


Hello PARI-dev,

I spent the last week skiing and experimenting with a new GP
parser/interpretor code.

That was done by merging the gp2c parser in PARI and adding
my (unreleased) GP interpretor code.

As it is an experiment, I focused on trying to implement 
some features out of the result rather than provide a
working prototype. As a result, the code is a complete mess,
but show how things could be done but it pass the PARI benchmark
with the exception of the amount of memory reported in the 
final getheap() call in the 'programm' check. The other getheap()
are correct due to some horrible kludge.

I put the resulting tarball here:
<http://pari.math.u-bordeaux.fr/~bill/pari-2.2.8.bill-1.tar.bz2>
You should not expect any feature not used in the benchmark to
work (and not even those)!

A summary of the way things work:
1) a yylex() fonction read analyseur and output lexical tokens with
values.
2) the yyparse function generated by bison call yylex() to read tokens
and output a syntactic tree.
3) A new function evalnode() read the syntactic tree and evaluate it,
returning the result.

The first step at this point would be to implement a completly
functionnal/correct yylex(). That should not be difficult but I don't
know the internal of the current parser sufficiently to make a good job.

At some point a stage 2.5) that optimize the tree for faster evaluation
will probably be added.

I will try to fix stage 2) to correct some minor discrepancies between
the old and new parser that came up.

Cheers,
Bill.