Bill Allombert on Sun, 15 May 2005 22:02:38 +0200


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

GP2C-0.0.4 released


Hello PARI-dev,

I have just released GP2C 0.0.4, the GP to C compiler

You can get it here:
<http://pari.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-0.0.4.tar.gz>

This is a major release, The main goal being to generate nicer code
that follow the current libpari interface and the C standard.

There are some changes to the interface, only the first being backward
incompatible:

1) Variables declared with a type do not have a default value anymore.
   See "Effect of types declaration on default values" in the manual.

This means the following is not allowed anymore:
func(x:gen)=x^2+1
f() /*argument missing*/
If you want to allow x to be omitted, you need to specify a default
value explicitly:
func(x:gen=0)=x^2+1
f() /*OK*/
However, if you do not specify a type, the old behaviour is preserved:
func(x)=x^2+1
f() /*OK*/

2) PARI/GP 2.1 is still supported but will not pass the test-suite,
because it has a bug in the prototype parser and it does not support
forvec in library mode.

3) You can now redefine a function. this is not very useful since only
the second definition is used, and GP2C will emit a warning, but this
allow the code below to compile: 

foo(x)=;
addhelp(foo,"Meta-syntatic function")
foo(x)=
{
 ...
}

4) ./configure now support a option --with-paricfg.dbg. This allow to
specify the pari.cfg file of a PARI installation compiled with 
./Configure -g and is used by gp2c-dbg, so you can have at the same time
gp2c-run using optimised PARI binaries and gp2c-dbg using debugging PARI
binaries.

5) You can add custom GP2C descriptions to desc/override.desc to tweak
gp2c behaviour.

6) You can define the types of several variables at once using the
following syntax:
local(var1,var2,var3):type 
this is a short-hand for 
local(var1:type,var2:type,var3:type)

7) Now gp2c support complex expressions as default values:
For example
f(x=[1,2])=local(z=vector(2,i,i));x+z 
will compile.
However beware tat the semantic might not match GP semantic in
self-referential cases:
f(x,y=x)=[x,y]
f(2) will return [2,2], while GP would return [2,x].

8) prodeuler is now supported.

9) This release was checked to work on a 64-bit plateform.

Additionally, a lot of other changes were made to make gp2c generate code
that follows the current libpari style (in particular it use gel(),
gerepileall(), NEXT_PRIME_VIA_DIFF() when available).

Cheers,
Bill.