1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Cookbook</TITLE>
<META NAME="description" CONTENT="Cookbook">
<META NAME="keywords" CONTENT="tpman">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="tpman.css">
<LINK REL="next" HREF="node36.html">
<LINK REL="previous" HREF="node22.html">
<LINK REL="up" HREF="tpman.html">
<LINK REL="next" HREF="node29.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html468"
HREF="node29.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="/usr/share/latex2html/icons/next.png"></A>
<A NAME="tex2html464"
HREF="tpman.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="/usr/share/latex2html/icons/up.png"></A>
<A NAME="tex2html458"
HREF="node27.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="/usr/share/latex2html/icons/prev.png"></A>
<A NAME="tex2html466"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="/usr/share/latex2html/icons/contents.png"></A>
<A NAME="tex2html467"
HREF="node58.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="/usr/share/latex2html/icons/index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html469"
HREF="node29.html">Structural Induction</A>
<B> Up:</B> <A NAME="tex2html465"
HREF="tpman.html">The Term Processor Kimwitu</A>
<B> Previous:</B> <A NAME="tex2html459"
HREF="node27.html">Interfacing with Structure Files</A>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00090000000000000000"> </A>
<A NAME="sec:cook"> </A>
<BR>
Cookbook
</H1>
The term processor <EM>Kimwitu</EM> supports a number of styles of programming functions
over trees.
Such styles are sometimes called <EM>paradigms</EM><A NAME="1071"> </A>, and we can therefore say that the
term processor supports <EM>multi-paradigm programming</EM>.
In this section we try to substantiate this claim by presenting some examples.
Each of these examples highlights a particular paradigm, some also show how paradigms
can be mixed.
<P>
The most fundamental paradigm of course is that of trees, and in particular trees in
which nodes of various types appear.
This structure appears in a number of ways in computer science.
<EM>Parse tree</EM> nodes correspond to the terminal and non-terminal symbols of a context-free language,
or more precisely, production instances of those symbols.
Normally an abstraction of parse trees is used, in which irrelevant terminal symbols and non-terminal
symbols are eliminated.
Such trees are usually called <EM>abstract syntax trees</EM>.
In abstract data type theory, trees denote <EM>expressions</EM> and a normal form of an expression
denotes its <EM>value</EM> in a certain sense.
Trees can also represent a prescription of the computation of a value,
or more general, a <EM>program</EM>.
<P>
The reason for mixing paradigms is that we want to exploit the strong points of each paradigm,
while at the same time avoiding their weak points.
Examples of such weak points are the following.
Attribute grammars allow only attributes to be computed over trees, where the computation
can not have a circular dependency.
Functional programming languages do not allow side effects to be expressed.
Abstract data type rewrite systems can only rewrite terms to their normal form.
Conventional programming languages, such as C,
usually force the programmer to be fairly aware
of the representation of data types.
<P>
<BR><HR>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"> </A>
<UL>
<LI><A NAME="tex2html470"
HREF="node29.html">Structural Induction</A>
<LI><A NAME="tex2html471"
HREF="node30.html">Unparsing</A>
<LI><A NAME="tex2html472"
HREF="node31.html">Attribute Grammars</A>
<LI><A NAME="tex2html473"
HREF="node32.html">Abstract Data Types and Rewrite Systems</A>
<LI><A NAME="tex2html474"
HREF="node33.html">Rewrite Systems and Functions</A>
<LI><A NAME="tex2html475"
HREF="node34.html">Memo Functions</A>
<LI><A NAME="tex2html476"
HREF="node35.html">Beyond Symbol Tables</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<!--Navigation Panel-->
<A NAME="tex2html468"
HREF="node29.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="/usr/share/latex2html/icons/next.png"></A>
<A NAME="tex2html464"
HREF="tpman.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="/usr/share/latex2html/icons/up.png"></A>
<A NAME="tex2html458"
HREF="node27.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="/usr/share/latex2html/icons/prev.png"></A>
<A NAME="tex2html466"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="/usr/share/latex2html/icons/contents.png"></A>
<A NAME="tex2html467"
HREF="node58.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="/usr/share/latex2html/icons/index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html469"
HREF="node29.html">Structural Induction</A>
<B> Up:</B> <A NAME="tex2html465"
HREF="tpman.html">The Term Processor Kimwitu</A>
<B> Previous:</B> <A NAME="tex2html459"
HREF="node27.html">Interfacing with Structure Files</A>
<!--End of Navigation Panel-->
<ADDRESS>
<I></I>
<BR><I>2000-04-17</I>
</ADDRESS>
</BODY>
</HTML>
|