view 0__Papers/Languages/POP/Intro.txt @ 108:e488b77f2015

Def of sync paper
author Sean Halle <seanhalle@yahoo.com>
date Sun, 09 Nov 2014 09:11:20 -0800
parents
children
line source
2 Pattern-Oriented-Programming, or POP, is an infrastructure whithin which languages are created. It provides a set of primitive operations and an OS-like environment in which the languages are first created and then used to write programs and execute them. Any existing language's computation model may be reproduced, however POP opens up possibilities for new models that have superior properties over existing ones. It also enables seamless interaction between languages, so a program can be constructed of modules written in different domain-specific languages that are then linked together.
4 POP has benefits for both language creation and program creation. One benefit is extensible syntax that can be made active so that the syntax itself performs transformations during construction or compilation of the code. This enables complex syntax such as the Tensor Notation, which is used in Physics. In the notation the particular placement of symbols and pattern-matching among them determines the operation to be carried out. With a normal parsed language, such parse-time behavior that determines the semantics is quite challenging, but POP provides facilities that simplify the task, making parse-time behavior a normal aspect of languages.
6 This is possible because program creation within the POP infrastructure directly modifies the syntax tree, skipping the parsing step altogether. As a result, programs are correct by construction, essentially eliminating compilation errors by providing the programmer with only valid possibilities at any point during program definition.
8 This has the additional benefit of facilitating learning a new language by using it. While writing code, the programmer may move the insertion point around and see the possibilities at each location, as well as read descriptions of each. They may even perform a full-text search through the descriptions of possibilities in order to find operations that perform desired behavior.
10 POP's normal programming environment is therefore graphical, with a representation of the code that is in progress and a graphical insertion point that represents the current position in the syntax tree. The syntactic element to insert there is chosen via a cascading menu system, or by typing the sequence of letters that selects the desired syntactic entity, or via text-based search through descriptions.
12 Because the environment is graphical, syntax normally has a graphical representation, although text-based is still possible. The visual representation of the syntax tree eliminates artifacts that exist in text-based syntaxes, such as the nesting of parentheses used to control the order of evaluation.
14 Advanced visual syntaxes are not only possible but POP facilitates them with features in its environment. This makes it practical to create, for example, a syntax that directly displays mathematical symbols as they would appear when written by hand or in a mathematics text book or paper. Math syntaxes already exist, but not ones easily extensible with new visual symbols that have meaning attached to placement and can perform parse-time behaviors. The POP system is advanced enough to create drawing-based syntaxes that convey meaning through the particular lines drawn, their connection points, and even orientation or physical placement relative to other components.
16 The syntax tree orientation of POP enables programs to construct syntax trees of their own, during the run, and invoke a POP facility that compiles the tree. The program may then direct POP to create a new process out of the compiled image and connect that process to the rest of the program. In fact, the POP environment treats a process as a permanent entity that remains live until a POP directive is used to end it.
18 As such, a POP program, once run, normally remains live continuously. The various processes that make up the running program remain dormant until input arrives. Input to a process then triggers activity within it. POP has a facility to save an image of a collection of processes and reproduce it at a future date, or even to transfer the image to a different POP system and re-animate a clone there.
20 The syntax tree orientation also enables advanced approaches to performant portability of code. The POP primitives have syntax tree transformation properties attached to them, such as commutativity, associativity, distributivity, and so on. Each property has associated rules for transforms that may be safely made to the syntax tree. Any POP based language may likewise attach these properties to its syntactic elements, which enables the associated transforms of the syntax tree. In addition, the language may define new properties, along with associated syntax tree transformations. This makes a large space of allowed transformations available to tools, which search through the space to find forms of the syntax tree that will execute well on target hardware.
22 The POP primitives are naturally parallel in nature. They expose communication, including that implied by side effects when locations are used to store data supplied by one primitive instance, and later forward it to a different primitive instance. However, POP encourages the equivalent behavior to be expressed through the use of explicit environments, which can be created, named, and passed around. Using them naturally makes side effect communication explicit and also clean, so that tools can directly infer the communicating entities and the causal relationship implied by the side effect communication.
24 As a result, even communication among iterations of loops are exposed, which lets the tools know the causal relationships among the iterations. The causal relationships are what the scheduler must enforce when choosing units of work to schedule onto physical processors. The scheduling is the heart of parallel processing, which determines what physical communications are performed and the consequent performance delivered.