PROP(ID:6876/pro089)


Extensions to C++ to enable pattern matching and forward chaining

from doc

  • String matcher, lexical analyzer, and parser generation. Currently the grammar is restricted to LALR(1) (with operator precedence).
  • ML-style algebraic datatypes and pattern matching.
  • Bottom-up tree rewriting (with conditionals).
  • Bottom-up tree parsing with dynamic programming for cost minimization.
  • Incremental forward chaining inference using a RETE-style algorithm.




  • Related languages
    C++ => PROP   Extension of
    DATALOG => PROP   Incorporated some features of
    ML => PROP   Incorporated some features of

    References:
  • Leung, Allen "Prop - Language Reference Manual" view details Abstract: This reference manual provides an introduction to Prop, release 2.3.4. Prop is a multiparadigm extension of C++, and is designed for building high performance compiler and language transformation systems, using pattern matching and rewriting. This guide describes the syntax and semantics of the Prop language and describes how to develop programs using the Prop to C++ translator. External link: Online copy
  • Leung, Allen "C++-based Pattern Matching Language" view details Abstract: In this paper we introduce Prop, a multiparadigm extension of C++
    with Standard ML-style algebraic datatypes and pattern matching, tree rewriting, DATALOG-style forward chaining inference, and constraint logical programming. Applications written in Prop can utilize various
    cooperating formalisms, integrated into the object oriented paradigm of the base language. We use efficient automata-based and semantics based algorithms to generate various pattern matching constructs into efficient and lightweight C++ programs. Interoperability with the base language is achieved transparently since all high level data structures in Prop are mapped into classes. Furthermore, we use
    conservative garbage collection schemes to minimize interaction with existing code by eliminating the need for manual storage management. Typical Prop program sources are 2--10 times more compact than equivalent programs written in C++. External link: Online copy Extract: Overview
    Overview
    Prop is a multi-paradigm extension of C++ that includes string matching, algebraic datatypes, Standard ML-style pattern matching, pretty printing, term and graph rewriting, inference, and simple persistence as built-in features. Prop is designed as a development language for interpreters, compilers, and language translation and transformation tools. It simplifies the construction of these systems by providing high level declarative and rule based formalisms on top of the traditional procedural and object-oriented paradigms of the base language.
    We design Prop with two main objectives in mind: the first objective is to improve the productivity of programmers working in a mainstream imperative language--- especially in domains such as compilers and language implementation--- by introducing high level formalisms based on trees and attributed labeled graphs, tree and graph rewriting, and finite set theory. By providing the users with a wide array of high level data structures and program combining forms, we encourage the use of the appropriate level of abstraction in each component of a language processing system. Rather than restricted to a single imperative mode of thinking, users can utilize applicative, transformational, equational, deductive, imperative or even a combination of formalisms in a cooperative manner. For example, syntactic analysis can be performed with the parsing/lexical analysis constructs of Prop; semantic analysis with pattern matching, tree rewriting, and inference; optimization with the SETL-style sub-language and graph rewriting; and, finally, code generation and machine language level tools development with tree reduction with dynamic programming and bit-string pattern matching.

    The second objective is high performance and portability. Programs written in Prop are lightweight and efficient: i.e. unneeded features are never included in the runtime system of a program, and those that are included are first transformed into interpretation free C++ code. All features are translated into C++ (using a source to source translator written in itself) using efficient algorithms. Maximal compatibility with the base language is maintained by mapping all high level data structures of directly into C++ classes. These classes can be used transparently as if they are written by the user. Thus we minimize the data impedance mismatch between different abstraction levels. A result of this is that high level programs written in Prop can readily utilize existing code and libraries with little change. An optional conservative garbage collector can also be linked into the runtime system for Prop programs that desire automatic memory reclamation.

    Resources