PCODE

Reading Time: < 1 minute

PCODE has been around for a while. It is an intermediate “code” that a source language can be compiled into. This PCODE represents an intermediate code (in place a machine language) that an interpreter program can run. Code written this way is CPU agnostic. I.E. If I right a program on a workstation with a x64 architecture I shouldn’t’ have to fear running it on a machine with a RISC ARM processor (say Raspberry PI) assuming system calls are also agnostic.

The oldest that I was aware of is Apple Pascal was compiled down to a PCODE which was then interpreted during the execution phase.

Wikipedia has a nice section on it: https://en.wikipedia.org/wiki/P-code_machine. It lists an even older use. It reminds us that Niklaus Wirth uses PCODE when discussing his Pascal-S compiler.

You will also hear the word BYTECODE – a distinction without much of a difference.

The Multi User Dungeon Systems (MUDS) used a bytecode. It was unique way system to work in. The interface; commands and objects were dynamic. If you change the code… the change was/(is) immediately put in place. The environment you worked on was live. The one I am most familiar with was from the 90’s (LPmud).

Python compiles into BYTECODE. The purpose is the same, to create an intermediate code that can be executed by an interpreter rather than natively by the CPU.


Java compiles to a class format referenced as bytecode.

See also:
“Algorithms + Data Structures = Programs” Niklaus Wirth
“Principles of Concurrent Programming” M. Ben-Ari
“The BYTE Book of Pascal” Blaise W. Liffick. Editor
“Turbo C The Complete Reference” Herbert Schildt

“The Java Virtual Machine Specification Second Edition” Tim Lindholm, Frank Yellin
“CPYTHON INTERNALS” Anthony Shaw