[fpc-devel] Porting FPC to IBM zArch

Bernd Oppolzer bernd.oppolzer at t-online.de
Wed Jul 24 11:36:57 CEST 2013


Normally, migrating ASCII sourcecode (be it C or Pascal)
to IBM z is no big deal; you transfer the source to the mainframe
by textmode FTP or similar tools, and everything works fine.

With C in the 90s, there were some issues, because the
C operator characters were at strange places in the different
national character sets. Sometimes you had to use so called
trigraphs, for example ??< for {, but today you put a #pragma in front
of the specific source code, specifying the char set (if you have
sources in different char sets, for example, which take part
in the same build) and everything works fine. You can use {, [ etc.,
the same way as on the PC, and customized to your national flavor
of EBCDIC, be it US-american or german (even the exclamation mark,
which is "NOT" in C, is at different places in the char set in US-EBCDIC
and german EBCDIC, which was a big issue in the 90s - no more today).

With Pascal, this should not be an issue at all, because we don't have
so many strange characters in the source char set like ~, \, | etc.

The only issue IMO are such things that I mentioned already:
char set range conditions. Big endianness is already solved,
because you have already big endian targets. I don't see any
non solvable problems.

Of course, you are right: in the end the compiler needs a charset option,
and the function that feeds the scanner with source lines has to do
the translation from EBCDIC to ASCII, for example. The compiler in its
internal logic remains ASCII.

I have some experience on such topics, for example: I wrote a very fast
lightweight XML parser for a customer of mine, which outperforms the
other XML parsers by a factor of 3. It runs on the IBM mainframe
and on Unix, Windows, OS/2 (which I still use as development platform).
Same code base for all platforms. There I have these issues, too.

Let's see. Migration of FPC compiler sources to the mainframe is
one of the later steps in my project. First of all, I have to gain more
experience with FPC. I would like to tell you all, that I am very impressed
about the size and the quality of this software - very good work!

Yesterday, for example, I observed that even writeln (s); for scalar types
s is supported - which IMO was not the case for older Pascals - very
convenient for quick tests ...

Kind regards

Bernd




Am 24.07.2013 10:02, schrieb Jonas Maebe:
> Such changes would only help if you would also convert the compiler's source code to EBDIC and tell the compiler compiler that this is the case, otherwise the (. 'A' .. 'I', 'J' .. 'R', 'S' .. 'Z' .) would still be interpreted as ASCII and hence be transformed in exactly the same code as it is now. The proper way to solve this is not to change the tests in the compiler source code (you would get a compiler that would only be able to parse either EBDIC or non-EBDIC source code), but to add EBDIC support to the compiler/scanner in a way that performs the translation to ASCII (or UTF-8, to keep EBDIC characters that cannot be represented in ASCII) before the characters are interpreted. This is different from the current code page support, which only translates string and character constants.
>




More information about the fpc-devel mailing list