[fpc-devel] EBCDIC (was On a port of Free Pascal to the IBM 370)
Daniël Mantione
daniel.mantione at freepascal.org
Mon Jan 30 17:29:27 CET 2012
Op Mon, 30 Jan 2012, schreef rvmartin2 at ntlworld.com:
> michael.vancanneyt at wisa.be wrote the following on 30/01/12 14:49:53:
>
>> I think the reason for producing an ASCII version first is very simple:
>> All FPC sources - including the compiler - are in ASCII encoding.
>
> I don't understand this statement - ASCII and EBCDIC are just human representations of a computer's internal code.
... which can be ASCII or EBCDIC encoded, right?
So if the compiler source files are ASCII encoded... then the compiler has
to read ASCII to be able to compile itself.
> I write my programs in the Latin (or Roman) alphabet and the computer
> does the rest.
So the compiler has to care about ASCII/EBCDIC encoding, right?
> When I was writing VS/Pascal programs I used the same source code as
> input to VS/Pascal on the mainframe and to Virtual Pascal on the PC.
>
> Unless the FP source code is to be fed into a mainframe compiler like
> IBM's VS/Pascal or the Stanford compiler then the first step is surely
> to write a backend for the (eg PC) compiler to produce 370 assembler
> code. Producing EBCDIC rather than ASCII sounds a trivial part of the
> task
Yes, but that's a difference topic than the source encoding. The compiler
doesn't care how the assembler generator communicates with the assembler;
it could be in any format, even binary. One just has to implement the
assembler generator correctly.
The compiler does care that the source it processes is ASCII. If it has to
be able to read EBCDIC, some conversion has to happen before the scanner.
As such a conversion is not necessary for the compiler to compile itself,
it may make sense to postpone writing such a conversion and have the
initial port be ASCII only.
Daniël
More information about the fpc-devel
mailing list