Geeks With Blogs
The Adventures Of Captain Kernel Reflections on our computational world

I was trained as a computer programmer using the PL/1 language. This was formal training, I had to be assessed at each stage and progress through the ranks of trainee programmer, assistant programmer, junior programmer eventually reaching senior programmer after several years.

During my training I was tutored by mentors, looking back those people were some of the best software developers I ever worked with yet in those days the title “software developer” didn’t exist.

The training included written and spoken technical communications, defining meeting agendas and chairing meetings, specification writing, algorithm appreciation and of course in-depth understanding of the PL/1 language – as used on IBM mainframes.

Back then ‘C’ was an academic language with very little presence in the commercial world, Pascal was more prevalent than ‘C’ back then, the three major languages were COBOL, Fortran and PL/1. I’d had a choice in college of specializing in one of these three and after some research in the library it was a no-brainer for a technically inclined person like me, PL/1 was far more advanced than the others.

Here are some lesser known facts about this language:

Until relatively recently the IBM PL/1 optimizing compiler was the most complex compiler in existence.
PL/1 was the first high level language used to write an operating system (Multics).
PL/1 was the first language to use /*   */ for comments
PL/1 was the first language to use the term “static” for non-stack-frame variable storage.
It was the first language to incorporate stack frame based exceptions (called “conditions”).
It is the only programming language to have no reserved words.
It was the first language whose compiler was written in that language.
It was the first language to use the notation –> for pointers.

As a system programming language it was far superior to ‘C’ and writing compilers and operating systems in PL/1 led to several advantages in terms of reliability, performance and maintenance.

I wrote an almost complete PL/1 compiler in ‘C’ for Windows NT (32 bit COFF) and still have all the source (it’s a Visual Studio 2005 solution I think). The parser’s ability to support the “no reserved words” requirement though very powerful is not overly complicated, here’s how its done.

There are only two kinds of statements really: keyword statements and assignment statements.

A keyword statement might be: call log_fault(“Invalid message received”); or perhaps: do while (flag = FALSE)

An assignment statement is ALWAYS of the form <reference> = <expression> ;

So the parser simply decides whether a statement is an assignment or not, if it is then keywords don’t matter and the identifiers can be anything.

This is why PL/1 lets you code

   1: if then then 
   2:    else = then;
   3: else 
   4:    then = if;

 

The grammar is very powerful, and you don’t need == for comparison as you do in ‘C’ just a single = suffices for assignment and comparison.

Incidentally the reason PL/1 supports this isn’t to let you write bewildering code, its to allow the introduction of new keywords in the future without breaking existing code.

A very helpful paper on the implementation of a real PL/I compiler was written by Bob Freiburghouse in 1969 and here is another fascinating write up that goes into some detail about how the language came to be chosen as the basis for Multics. Bob’s paper was immensely helpful to me as I began to outline the design and overall approach for my own PL/I compiler, anyone interested in compilers and their implementation and history should value these resources.

Posted on Saturday, November 23, 2013 2:14 AM PL/1 , Compilers , Optimizer , Multics , COFF , Programming Languages | Back to top


Comments on this post: PL/1

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Hugh Gleaves | Powered by: GeeksWithBlogs.net