> 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 â syntax â meaning;
> 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.
> 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.
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 name â syntax â type â meaning;
> 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):
declare_pattern
  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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4