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

in #story7 years ago (edited)

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



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 th 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, that 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 to reverse engineer 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 integer, not floating point.

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 accused 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 to follow me

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



Sort:  

Well, I don't think you could have been accused of stealing the compiler because from what I understand, you improved it and added some additional features. Anyway, I hope nothing bad happened, I guess I'll know in the next part...

Fascinating insights. I live near Windsor Junction. My work in the mid 70's at home was writing hex code programs using the RCA 1802 Cosmac Elf, home built computer, with 1,024 bytes of RAM (not KB, or MB).

I have never heard of the RCA 1802 Cosmac Elf. I found a little information here.

Cool link. Here's a photo of my "baby". I designed it to mimic the popular Imsai 8080 at the time. Note the big 2 digit HEX display! I mainly used it to control other electronics. Had dreams of controlling a robot. The Popular Electronics magazine got me started on that path.
IMG_0143.JPG

As always whenever you write down, you put all of us youngsters to shame.. You are immensely talented and it draws a lot of confidence in others like me

I didn't know anything about 'Pascal Programming Language' , after reading your post , I have learned a lot Pascal Programming Language & little about work . Thanks man, keep on enrich our knowledge with your great work.

Wow, I can't believe I missed 64 chapters, how am I going to read all!!!!. This is wonderful

Excellent story.

This great story.... i appreciate your post.

Sir you know about Pascal language too..Knowing computing stuff too..I think I should stop praising u anymore...You are such an exemplary inspiration to all of us..Be it with any phase of your life

Very interesting story, I really like this article!
I am new on Steemit so I'd really love to make some friends here! If you want for us to support each other, please show me some love on my account and I will make sure I keep reading your lovely articles! :)

Wow!!! To think that you were getting involved with stuff at the ground floor. It must have been so much fun and exciting too. Looking forward to reading about how the company does.