what?    why?    demo!    get!    how?    who?

> what is π?_


> There is only one language construct in π: the pattern. Patterns are, simply speaking, a function with a syntactically complex (context-free) "signature"; from the other point of view: a grammar rule (extended EBNF) with an associated meaning. The non-terminal symbols in the signature are then the parameters of the pattern. A π-program is a sequence of instruction symbols (technically, sentences), each being a sequence of (Unicode) characters. The sentences are evaluated (executed) in the respective order.

> A new parameterized symbol (syntax) is defined by the pattern-declaration instruction (the parameters are underlined here):

declare_pattern ≔ syntaxmeaning;

> This notation reduces the pattern-definition to the absolutely necessary: syntax and meaning. In addition to that, patterns can be named; and in order to provide type safety, each pattern can have an (explicit) type.

> a pattern language_

> 2010-01-22_

π 0.8 is released. Several of the remaining problems described in the article have been solved now. Please, download π and try out yourself. We appreciate feedback of any kind!

> 2009-10-27_

π is presented at OOPSLA/Onward! '09 ...


"It is good to design a thing, but it can be far better […] to design a pattern."

Christopher Alexander

"[…] from now on, a main goal in designing a language should be to plan for growth."

Guy Steele


syntactically extensible


pattern oriented



"A Pattern Language"

(Christopher Alexander)

-Film: "Pi"
(Darren Aronofsky)


Pegasus Project


Software Technology Group

OOPSLA/Onward! '09

> In our opinion, the essence of programming is abstraction. A pattern language is based on that principle. π theoretically is an abstraction mechanism, a functional language, a minimal language, a calculus and the manifestation of semiotics in programming. π practically is a growable programming language, a language design tool, a hyper-language and a philosophy of how to design software. π technically is a fully reflective dynamically both semantically and syntactically extensible programming language (thus a macro language, as well).

> While doing research on naturalistic programming we found that the possibility to define parameterized symbols – patterns, is an essential feature of (written) natural language itself. We decided to develop a language – π – which is completely dedicated to this paradigm.

> Current programming languages and techniques realize many features which allow their users to extend these languages on a semantic basis: classes, functions, interfaces, aspects and all sorts of entities can be defined. However, there is a lack of modern programming languages which are both semantically and syntactically extendable from within the language itself with no additional tool nor meta-language. We see π as an approach that aims to overcome this lack.

> In addition to that, with π we provide a clean and easy mean for the design of new (experimental) languages and domain specific languages.

> a pattern language_

This type defines all places where the occurrence of the respective symbol will be valid in the program. So the complete pattern-declaration instruction looks as follows:

declare_pattern namesyntaxtypemeaning;

> An example: the following pattern declaration defines both the syntax and the semantics of integer-potentiation symbols like, for instance, "174^3" or "2^19". All constructs used here for defining the meaning of that pattern are predefined in π and can for now be interpreted in an intuitive way (see below; %W- suppresses the occurrence of whitespaces):

   integer_potentiation ≔
integer:i %W- "^" %W- integer:j
   ⇒ integer ➞
      int result = i;
      for (int k = 1; k <= j-1; k++)
         result *= i;
      return result;

> After the declaration of that pattern, its applications can be immediately used at any place where an integer symbol may occur, e.g., in an instruction like "print(174^3);".

> We will see later that the pattern-declaration instruction and any other of the predefined instructions of π, the so called "core-pattern-set", are patterns themselves; they are, for instance, instruction patterns like the pattern-declaration instruction, the print instruction and the for-loop or data patterns like the integer pattern or the pattern pattern – and yes, a pattern is a pattern itself, its syntax is as follows:

name "≔" syntax "⇒" type "➞" meaning

> Thus, the actual pattern-declaration instruction has the following syntax, i.e., it takes a pattern as a parameter:

"declare_pattern" pattern ";"

> The following little code-fragment is a complete π-program consisting of two pattern-declaration instructions and two other (predefined) instructions, "print" and "if", immediately making use of the just defined symbols (the operators ">" and "? :" are predefined patterns, too):

(1) declare_pattern maximum ≔
       "max" "("
integer:a "," integer:b ")"
       ⇒ integer ➞ ( a > b ) ? a : b;

(2) print( max (13^2, 101) );

(3) declare_pattern absolute_value ≔
integer:i "|" ⇒ integer ➞
       ( i ≥ 0 ) ? i : -i;

(4) if ( max (13^2, |-171|) > 169 )
       print ("yes!");

> After the first pattern-declaration (line 1), the interpreter would know the pattern "maximum". Therefore the second instruction (line 2) is correctly interpreted. After the second pattern-declaration (line 3), the interpreter knows both the user-defined patterns "maximum" and "absolute-value" and can correctly interpret the last instruction-symbol (line 4) which is making use of both of them.


Name: π

Kind: Computer Language

Age: ~ 1 year

Birthday; 2009-01-13

Birthplace: TUD

Parents: Pegasus Project