A Racket/Scheme implementation using RPython. It adds a JIT.
In order to do anything with Pycket, you need to check out PyPy:
$ hg clone https://bitbucket.org/pypy/pypy
The below instructions assume that you do this checkout in this directory.
Additionally, it helps to have the build dependencies of PyPy installed. On a Debian or Ubuntu system:
$ sudo apt-get build-dep pypy
You also need a reasonably recent version of Racket, at least version
6.1.1. Then you need to set up the pycket language in Racket:
$ raco pkg install -t dir pycket/pycket-lang/
Afterwards you can run the unit-tests as follows:
$ pypy/pytest.py pycket
or using make
$ make test
To produce an executable, run:
$ ./pypy/rpython/bin/rpython -Ojit targetpycket.py
This expects that a binary named pypy is in your path. (Note that
a hand-compiled PyPy by running make produces pypy-c, not pypy).
If you don't have a compiled pypy, you can also translate with:
$ python ./pypy/rpython/bin/rpython -Ojit targetpycket.py
This will take upwards of 10 minutes.
This requires a PYTHONPATH that includes both rpython (that should
be the pypy directory cloned above) and pycket (that should be
this directory).
You can also use make for any of the above,
make setupto setup the Racket language and update yourpypychekoutmake pycket-cto translate with JITmake pycket-c-nojitto translate without JIT (which is may be a lot faster to translate but runs a lot lot slower)
Afterwards you can execute a program:
$ ./pycket-c program
You can also run pycket under plain python, like this:
$ ./pycket-slow.sh program
Or even this, when this directory is in your PYTHONPATH:
$ python -mpycket program
You can edit the shell script to make it use pypy, if desired.
You can generate a coverage report with pytest:
$ pypy/pytest.py --cov .
or via
$ make coverage
which also generates an HTML report in pycket/test/coverage_report.
You need these Python packages for that to work:
pytest-cov(provided with thepypycheckout)cov-coreandcoverage
Also, the Makefile reacts to some variables:
PYPYPATHfor when yourpypycheckout is not in this directory.
Defaults topypy.PYTESTfor when you don’t want to usepypy’s version of pytest.
Defaults to$(PYPYPATH)/pytest.py.RPYTHONfor when you want to use something other than the defaultrpythonscript, but you probablywould not want that.
Defaults to$(PYPYPATH)/rpython/bin/rpython --batch.
Pycket's benchmarks are available at this repository, along with instructions for running them.
