/ Resources / References / P-Code / What is P-Code?

RCOS.java Home Page
One of the first attempts to provide a truely platform independent programming language came with the introduction of Pascal and the p-Machine.  A Pascal-P compiler would generate an intermediate code called P-Code.   P-Code is the native assembly language of a hypothetical, stack machine, called the P-Machine.  The origins of this instruction set is said to be from the Burrough Large System.  Each new system could simply implement the P-Machine and run any P-Code.

The term was first used in "Algorithms + Data Structures = Programs", N. Wirth, P-H 1976.  Byte articles on writing a Pascal Compiler in Northstar BASIC (August, 1978) is the basis of the RCOS implementation.  Additions of the basic specification were made to accomodate RCOS specific features such as reading and writing of files, shared memory, and semaphores.

p-Source and the Osborne User's Guide are two of the many books written at the time to support the growing number of home and business computers running P-Code based systems: including TRS-80, Apple II, Osborne 1, CoCo 3, etc.

This idea of compiler design, where there is a step between compilation and generating machine specific code, is still used today.  Apart from the obvious (Java), it is used in products such as Power Builder, Visual Basic and Delphi.