p2c -- a Pascal to C translator

permanent url for this page: https://alum.mit.edu/www/toms/p2c/

p2c converts the computer language Pascal to C which you can then compile with cc or gcc.

The p2c program was written by Dave Gillespie. A copy of his original home page is Dave Gillespie Home Page. It has some useful information about the translator but the links are now broken.

For simplicity I have put the historic files into a p2c archive.


Current version:
p2c-2.02.zip

This works on MacOS Monterey Version 12.6. It requires that you install Xcode. This version works with Xcode 14.
(Note: Because zip does not allow '.' periods in the name of directories, the zip file will unzip as a directory 'p2c-2-ZIPPERDOT-02/'. Instead of unzip you could use the unzipper script or follow the instructions below.)

Setting up p2cc
Here are the Terminal commands to get and compile p2c:

echo "*** download:"
curl -OL https://alum.mit.edu/www/toms/p2c/p2c-2.02.zip

echo "*** unzip:"
unzip p2c-2.02.zip

echo "*** fix the name:"
mv p2c-2-ZIPPERDOT-02 p2c-2.02

echo "*** compile:"
cd p2c-2.02
make install

echo "*** Test converting a program:"
cd /tmp
mkdir delilatest
cd    delilatest
echo "*** first get a copy of makelogo.p:"
curl -OL https://alum.mit.edu/www/toms/ftp/makelogo.p
# However, if you already have a delila directory you could do this:
# cp ~/delila/makelogo.p .
echo "*** then get a copy of the tc translator that calls p2c:"
curl -OL https://alum.mit.edu/www/toms/ftp/tc
chmod a+xr tc
tc makelogo



Additional Links:

color bar Small icon for Theory of Molecular Machines: physics,
chemistry, biology, molecular biology, evolutionary theory,
genetic engineering, sequence logos, information theory,
electrical engineering, thermodynamics, statistical
mechanics, hypersphere packing, gumball machines, Maxwell's
Daemon, limits of computers


Schneider Lab

origin:    2013 Feb 23
updated: 2022 Oct 17

color bar