PGA - ProGram Algebra

High-level MPPV

HMPPV is based on MPPV. It has some instructions that are a shorthand for commonly used combinations of instructions in MPPV. And in addition to the type of values provided by MPPV, it has strings.

Instructions

Here, extfocus (extended focus) is either a focus, or a field selection that may also be compound (like x.f.f). The type for strings is str and string values must be delimited by double quotes ("), and a backslash (\) and a double quote inside a string must be preceded (escaped) by an additional backslash. The set of characters that may appear in a string are the alphanumeric characters, the punctuation characters, the space, and the newline in the form of \n.
extfocus = new
Create a new atom and assign it to extfocus. When extfocus is a field selection, it must be of type atom.
extfocus1 = extfocus2
Assign the value in extfocus2 to extfocus1. When extfocus1 is a field selection, the field must be of the same type as the value in extfocus2.
extfocus.+f
Add a field of type atom to the atom selected by extfocus.
extfocus.+f = new
Add a field of type atom to the atom selected by extfocus, and assign it a newly created atom.
extfocus1.+f = extfocus2
Add a field of type atom to the atom selected by extfocus1, and assign it the aotm selected by extfocus2.
extfocus.+f:t
Add a field of type t to the atom selected by extfocus.
extfocus.+f:t = u
Add a field of type t to the atom selected by extfocus and assign it the value u.
extfocus1.+f:t = extfocus2
Add a field of type t to the atom selected by extfocus1 and assign it the value selected by extfocus2.
extfocus.-f
Removes the field f from the atom selected by extfocus. Returns false when the atom has no field f.
extfocus/f
Returns true when the atom selected by extfocus has a field f, and false otherwise.
extfocus1 == extfocus2
Comparison of the values selected by extfocus1 and extfocus2. Returns true when the values selected by extfocus1 and extfocus2 are the same or contain the same atom, and false otherwise.
extfocus?
Returns true when the value selected by extfocus is an atom, and false otherwise.
extfocus?t
Returns true when the value selected by extfocus is of type t, and false otherwise.

Example

The following list of MPPV instructions
h1 = x.f;
h1 = h1.f;
h2 = new;
h1.f = h2

can be written with HMPPV as

x.f.f.f = new