[fpc-other] Stanford Pascal Compiler successfully ported to Windows, OS/2 and Linux

Mark Morgan Lloyd markMLl.fpc-other at telemetry.co.uk
Sat Dec 24 14:21:48 CET 2016


On 24/12/16 12:30, Bernd Oppolzer wrote:
> Am 24.12.2016 um 12:50 schrieb Mark Morgan Lloyd:

> You are mentioning SUCC and PRED with CHAR; that is a very cood example.

It's not so much a good example as a specific sticking point that was 
mentioned in earlier discussion on the ML.

> These functions are implemented based on the underlying character set;
> that means, that SUCC('R') is not 'S' on EBCDIC, because there is a gap
> between
> 'R' and 'S in the EBCDIC codepage (six other characters between 'R' and 'S'
> which are not alphabetic).
>
> This is a portability problem which appears at the source code level (!)
> and cannot be healed by the compiler. It is the same with the C language,
> and the sensible programmer has to deal with this, if he or she wants to
> have his or her programs really portable.

At least a-f are consecutive, and it's still possible to switch letter 
case with an addition. I've used a tool in the past, written by what I 
have to assume was one of the Three Wise Men, which made no assumptions 
other than that 0-9 were consecutive: everything else was specified on 
the first line of every file.

> My problems with the Stanford compiler were different; if the compiler
> generates
> code which will not run on a platform using a different code page,
> because it generates
> branch tables when implementing case statements that imply a certain
> code page,

Ouch :-(

> Regarding ^:
>
> "my" compiler supports different representations for the pointer symbol,
> and for other
> critical symbols, too:
>
> ^  @  ->   for the pointer symbol (I use -> most of the time)
> [   (.   (/   for arrays
> {   (*  /*   for comments  ("comment" is supported, too, for historic
> reasons)

/* was the form used in the first edition of Wirth's description of 
Pascal (might have been before Jensen was there to help out). However 
I'd strongly suggest deprecating @ and replacing it with another 
digraph, it's used as the address-of operator in Turbo Pascal and its 
successors.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]


More information about the fpc-other mailing list