P is a small garbage collected programming language whose programs run in a virtual machine. I have been inspired by Borland Pascal with Objects version 7.0 manual from 1992 that I have in my bookshelf. When comparing P to the Borland Pascal with Objects, this 0.2.0 version of P still lacks a proper standard library. On the other hand I have added simple copying garbage collector and overloaded constructors that the Borland Pascal does not have. Otherwise P is pretty close to the original Borland Pascal with Objects.
Here's a Hello World program written in P:
For compiling and running programs we have two commands: compiler pc and executor rp . To compile and run the Hello World, execute the following commands in Windows command prompt:
The compiler translated the source code text Hello.p to a Hello.pcode binary file. The .pcode file contains both metadata and virtual machine instructions.
For inspecting the contents of a .pcode file, P has a third program: pd :
The pd program dumps the contents of the Hello.pcode file to a text file Hello.pcode.txt . The dump contains virtual machine instructions in the code section:
P has been implemented in C++ using Microsoft Visual Studio 2022.
The syntax diagrams in this documentation have been generated using a P program SyntaxDiagrams.p included in the project. This program and the system library units acted also as tests for the P compiler.