James Larson
Programmer/Analyst Consultant
A.K.A.
The Computer Guy
Resume

Remember, it takes hard work to make computers easy to use.
Links to other sites I like.

P2 Compiler Porting Club

Do you consider yourself a hard-core computer nerd? Are computers more to you than a complex assemblage of unfathomable wires and parts? Do you feel an urgent need to write your own computer programming language?

Given a choice, would you prefer writing xor eax,eax over mov eax,0? Could your write 500 words as to why one is better than the other?

Well, you have come to the right place. The P2 Compiler Porting Club is an association of like-minded enthusiasts who appreciate computer history and a good hack.

The membership requirement is simple: write a program that compiles the P2 compiler, and then make the compiler compile itself. That's it. I've already done it. It's not trivial, but it isn't rocket science, either. I will say that any sufficiently motivated, persistent computer programmer should be able to whip it out in a week.

Sound a bit recursive? A fitting tribute to N. Wirth!

And the reward? Bragging rights, of course. Anyone who is familiar with the skills needed to pull this off will instantly know you are an excellent programmer. Once word of this club spreads, it will be a great resume enhancement. It will be a common achievement among us nerds to share knowingly among ourselves.

Download the P2 Compiler Source: p2.zip This zip contains two files: pcomp.pas and pint.pas The former is a Pascal compiler, written in a subset of standard Pascal, which can compile itself into a VM assembly language. The latter (pint.pas) is the assembler/interpreter of that VM assembly output. You'll have to make a few adjustments to pcomp.pas to get it to compile, but nothing major. The real work is in converting pint.pas to C and getting it to run correctly.

The Challenge

  1. Write a program in ANSI C which assembles and runs the VM assembler output of the pcomp.pas compiler.
  2. Compile pcomp.pas with your C interpreter.
  3. Compare the VM assembler output of step 2 above with the VM assembler program which compiles pcomp.pas. They must be identical.
  4. Send your C source file, and any other necessary files, to me: jlarson43@juno.com
I'll check your work, and, if you get it right, post your name on this page, with appropriate accolades.

A good resource is www.threedee.com/jcm/psystem You can learn a lot about N. Wirth and the CDC 6000 series computers he developed Pascal on. B.T.W., its where I found p2.zip.

Have fun, and good luck!



Visitor #


This web site has been written and distributed by

James Larson
Programmer/Analyst Consultant
http://www.dst-corp.com/james
E-mail address
In God We Trust...