The Story of My Life so Far - Part 65 - Writing a Compiler for the Pascal Programming Language

This is the story of my life so far: 68 years and counting.
Prequel: A Brief History of my Family in France


Vincent_Tahiti_1972_02.jpg

The story starts here
Previous episode: Part 64


I Discover the Pascal Programming Language

Ron, my Canadian officer friend, made me discover the Pascal programming language.
Pascal was created by Niklaus Wirth, a Swiss computer scientist, who published the manual for Pascal in 1970.


Niklaus_Wirth_large.jpg
Niklaus Wirth in 1969
source: Wikipedia

Also, Ron made me discover Byte, a microcomputer magazine. I immediately bought a subscription.

We saw in one issue of Byte a commercial for a Pascal compiler, written by some guys in Windsor Junction, a small community less than 30 km from Halifax.

I Buy a Small Pascal Compiler that I Reverse Engineer

So, I bought a copy of this Pascal compiler. As I remember, the price was CAD$29.95, so not very expensive.

I started to write small toy programs using this Pascal compiler.
Soon, I was more interested in the compiler than in writing programs for it.

I rapidly discovered that the compiler was converting the Pascal sources into pseudo-code, which is binary code for a virtual machine. This is very similar to what was being done at the time with UCSD Pascal and the UCSD p-system.

The executable program produces by the compiler included a copy of an interpreter. When running the program, the interpreter was reading the pseudo-code an executing its instructions.

I decoded the interpreter to understand what each instruction of the pseudo-code was doing.
I gave meaningful names for each pseudo-code, such as "ADD" or "LOAD", and I wrote in Pascal what I called a "depseudocoder" to list the pseudo-code of the compiler in something readable.

Like most Pascal compilers, this one was itself written in Pascal.
From the output of my depseudocoder, I tried to rewrite in Pascal the compiler, until I produced the exact same pseudo code of the compiler I had bought.

I had succeeded in reverse engineering the Pascal compiler.

I write my Own Pascal Compiler

The Pascal compiler that I had bought was only supporting a subset of the Pascal programming language.
For example, the numerical variables could only be integers, not floating-point numbers.

I had decided to write an improved compiler that would include several of the missing features in the compiler I had bought, in particular floating-point arithmetic.

I was still using pseudo code, but I had completely changed the values of the codes so that nobody would accuse me of having stolen the compiler, although that was in fact what I had done.

When my compiler was in good shape, probably at the beginning of 1982, I decided to create a small company and to sell my Pascal compiler all over the world.

Continue to Part 66


If you like this story, please consider following me @vcelier

Summary
Part 1 - Part 2 - Part 3 - Part 4 - Part 5 - Part 6 - Part 7
Part 8 - Part 9 - Part 10 Part 11 - Part 12 - Part 13 - Part 14
Part 15 - Part 16 - Part 17 - Part 18 - Part 19 - Part 20 - Part 21
Part 22 - Part 23 - Part 24 - Part 25 - Part 26 - Part 27 - Part 28
Part 29 - Part 30 - Part 31 - Part 32 - Part 33 - Part 34 - Part 35
Part 36 - Part 37 - Part 38 - Part 39 - Part 40 - Part 41 - Part 42
Part 43 - Part 44 - Part 45 - Part 46 - Part 47 - Part 48 - Part 49
Part 50 - Part 51 - Part 52 - Part 53 - Part 54 - Part 55 - Part 56
Part 57 - Part 58 - Part 59 - Part 60 - Part 61 - Part 62 - Part 63
Part 64

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now