Hello Tony,
I think, I have a description somewhere of the 1979 variant of P-Code used
in the Stanford compiler (scanned document). I'll send it to you offline.
The two passes of the compiler are written in Pascal, and the second one
generates 370 object code from P-Code; it writes the 80 byte object code
records directly using Pascal-I/O.
My regression tests go like this: compile the new compiler using the old
compiler,
then compile it again, using the new compiler, then compile some test
programs
and look for changes in the generated code. Evaluate them.
Kind regards
Bernd
Am 02.10.2013 03:40, schrieb Tony Harminc:
On 1 October 2013 20:06, Bernd Oppolzer <[email protected]> wrote:
Stanford PASCAL also generates P-Code in the first step,
which in the second step is translated to 370 machine code.
Interesting; I had thought that P-code was only interpreted.
BTW: The P-Code of the 1982 variant of the Stanford compiler
had been extended compared to the 1979 variant, and because
I found only a description of the 1979 variant, it was a little bit
complicated to find out what the "new" P-Code instructions do.
There is not "one" P-Code, but many variants of P-Code.
And: it turned out, that the P-Code is not so machine-independant
as it should be. There will be some difficulties regarding character
sets etc., when I try to port the compiler to an ASCII based platform,
for example (which I would like to do in the future).
You could instead generate JVM bytecodes... It's almost machine-independent.
I haven't looked at P-code (is there an accessible overview?), but had
heard of it long ago. When Java came out I looked at the JVM reference
book, and thought - Oh, this isn't too complicated, I could write an
interpreter for it in a week or so and have my own JVM. But it turns
out that the hard part of a JVM isn't the bytecode interpreter at all;
it's all the class loading stuff.
I imagine the P-code system doesn't have such heavy baggage.
Tony H.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN