comparison doc/misc/html/examples/mpp/ex.html @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>Expression Evaluator - Macro preprocessor and C Parser </TITLE>
5 </HEAD>
6
7
8 <BODY BGCOLOR="#ffffff" BACKGROUND="tilbl6h.gif"
9 TEXT="#000000" LINK="#0033CC"
10 VLINK="#CC0033" ALINK="#CC0099">
11
12 <P>
13 <IMG ALIGN="right" SRC="../../images/agrsl6c.gif" ALT="AnaGram"
14 WIDTH=124 HEIGHT=30 >
15 <BR CLEAR="all">
16 Back to :
17 <A HREF="../../index.html">Index</A> |
18 <A HREF="index.html">Macro preprocessor overview</A>
19 <P>
20
21
22 <IMG ALIGN="bottom" SRC="../../images/rbline6j.gif" ALT="----------------------"
23 WIDTH=1010 HEIGHT=2 >
24 <P>
25 <H1> Expression Evaluator - Macro preprocessor and C Parser </H1>
26
27 <IMG ALIGN="bottom" SRC="../../images/rbline6j.gif" ALT="----------------------"
28 WIDTH=1010 HEIGHT=2 >
29 <P>
30 <BR>
31
32 <H2>Introduction</H2>
33 <P> The Expression Evaluator module, <tt>ex.syn</tt>, exists only to
34 evaluate the conditional expressions in <tt>#if</tt> and
35 <tt>#elif</tt>
36 statements. The syntax for these expressions has been
37 extracted from a full C syntax and reduced to that which is
38 necessary for this purpose.
39 <P>
40 The rules for the evaluation of constant expressions are
41 given in Kernighan and Ritchie, sections A7.19 and A12.5
42 <P>
43 <BR>
44
45 <H2>Theory of Operation</H2>
46 The only unusual feature of this grammar is the
47 interposition of a token called "nonzero" to avoid division
48 by zero. Otherwise the grammar is a conventional expression
49 grammar.
50 <P>
51 The parser is implemented as an event driven parser. The
52 initializer is <tt>init_ex()</tt>. The parser itself is
53 <tt>ex()</tt>. The
54 parser has been interfaced to the rest of the program by a
55 class definition, <tt>expression_evaluator</tt>.
56 <P>
57 The class definition for <tt>expression_evaluator</tt> is given in
58 <tt>mpp.h</tt>. Each instance of the class has its own parser control
59 block. Therefore the parser makes all of its references
60 indirectly through a pointer, <tt>ex_pcb</tt>. Whenever it is
61 necessary to invoke <tt>init_ex()</tt> or <tt>ex()</tt>,
62 therefore, it is
63 necessary first to make sure <tt>ex_pcb</tt> is correctly set.
64 <P>
65 Input to the parser consists of tokens as defined in
66 <tt>token.h</tt>. Since the input does not consist of simple
67 characters, the <b>input values</b> switch is set. The input
68 procedures store the full token into the input_value field
69 of the pcb and the id field into input_code.
70
71 <P>
72
73 <BR>
74
75
76 <IMG ALIGN="bottom" SRC="../../images/rbline6j.gif" ALT="----------------------"
77 WIDTH=1010 HEIGHT=2 >
78 <P>
79 <IMG ALIGN="right" SRC="../../images/pslrb6d.gif" ALT="Parsifal Software"
80 WIDTH=181 HEIGHT=25>
81 <BR CLEAR="right">
82
83 <P>
84 Back to :
85 <A HREF="../../index.html">Index</A> |
86 <A HREF="index.html">Macro preprocessor overview</A>
87
88 <P>
89 <ADDRESS><FONT SIZE="-1">
90 AnaGram parser generator - examples<BR>
91 Expression Evaluator - Macro preprocessor and C Parser <BR>
92 Copyright &copy; 1993-1999, Parsifal Software. <BR>
93 All Rights Reserved.<BR>
94 </FONT></ADDRESS>
95
96 </BODY>
97 </HTML>
98
99