next up previous contents index
Next: A quick tour Up: Prop Language Reference Manual Previous: Debugging Parsers

Algebraic Datatypes and Pattern Matching

tex2html_wrap6335. ALGEBRAIC DATATYPES AND PATTERN MATCHING  

Prop implements algebraic datatypes and pattern matching in the style of Standard ML[HMM86]. Tree, DAG and even graph structures can be specified as a set of datatype equations in algebraic datatype specifications. Prop then proceeds to translate these into concrete C++ classes. This makes it very easy to implement complex data structures.

Algebraic datatypes can be manipulated and transformed using Prop pattern matching constructs, which decompose a datatype value into its constituents. Complex patterns involving multiple objects can be specified. These are translated into efficient testing and selection code in C++.

In the following we shall give a brief overview of the pattern matching features of Prop. For most users of modern declarative languages many of these features are already familiar constructs.





Allen Leung
Mon Apr 7 14:33:55 EDT 1997