The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,843 other followers

Hollerith and why we have digraphs in Pascal and trigraphs in C/C++ (nostalgia, Apple ][ plus)

Posted by jpluimers on 2012/07/04

Apple ][ plus keyboardSome nostalgia (:

In the mid 80s, when programming in UCSD Pascal and Turbo Pascal, I learned that Pascal has (. and .) digraphs that translate into [ and ], similar to the (* and *) digraphs that translate to { and }.

In fact I thought the English word was bigraph (as bi- is a prefix for twice, just like tri- is a prefix for thirce).
The digraphs are lexical alternatives (Pascal ISO  standard 7185:1990 paragraph 6.1.9 or Extended Pascal ISO standard 10260:1990 paragraph 6.1.11). There is even one more: the @ at-sign is a lexical alternative for the ^ caret.

Back then (I was in my teens, there was no internet yet and school library had nothing on programming) I thought these were because keyboards like those of the Apple ][ plus couldn’t emit [ and ], but I was wrong: it was in fact the Hollerith Card Code that could not represent these characters.

That limitation was because of the first Pascal implementation was done on a CDC 6000 series that used punched card readers/writers.  You could not punch arbitrary numbers of holes on each row (lace cards lacked structural strength) limiting the character codes you can represent.

They still work in the Delphi compiler for arrays and for comments (I just learned that various Pascal implementations use different rules of mixing digraph and normal comments (some even allow nesting)).

While I taught myself C and C++ just as I taught myself Pascal, somehow I never learned that they use lexical alternatives too. It was only recently that they do, both as trigraphs and as of C99 also as digraphs and that there is even a trigraph tool as part of the C++ personality of RAD Studio 2007.

–jeroen

One Response to “Hollerith and why we have digraphs in Pascal and trigraphs in C/C++ (nostalgia, Apple ][ plus)”

  1. […] of you might remember that Apple ][ plus and Apple IIe was part of my early programming […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: