view doc/misc/html/examples/mpp/ex.html @ 21:1c9dac05d040

Add lint-style FALLTHROUGH annotations to fallthrough cases. (in the parse engine and thus the output code) Document this, because the old output causes warnings with gcc10.
author David A. Holland
date Mon, 13 Jun 2022 00:04:38 -0400
parents 13d2b8934445
children
line wrap: on
line source

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Expression Evaluator - Macro preprocessor and C Parser </TITLE>
</HEAD>


<BODY BGCOLOR="#ffffff" BACKGROUND="tilbl6h.gif"
 TEXT="#000000" LINK="#0033CC"
 VLINK="#CC0033" ALINK="#CC0099">

<P>
<IMG ALIGN="right" SRC="../../images/agrsl6c.gif" ALT="AnaGram"
         WIDTH=124 HEIGHT=30 >
<BR CLEAR="all">
Back to :
<A HREF="../../index.html">Index</A> |
<A HREF="index.html">Macro preprocessor overview</A>
<P>


<IMG ALIGN="bottom" SRC="../../images/rbline6j.gif" ALT="----------------------"
        WIDTH=1010 HEIGHT=2  >
<P>
<H1> Expression Evaluator - Macro preprocessor and C Parser   </H1>

<IMG ALIGN="bottom" SRC="../../images/rbline6j.gif" ALT="----------------------"
        WIDTH=1010 HEIGHT=2  >
<P>
<BR>

<H2>Introduction</H2>
<P>          The Expression Evaluator module, <tt>ex.syn</tt>, exists only to
          evaluate the conditional expressions in <tt>#if</tt> and
	  <tt>#elif</tt>
          statements. The syntax for these expressions has been
          extracted from a full C syntax and reduced to that which is
          necessary for this purpose.
<P>
          The rules for the evaluation of constant expressions are
          given in Kernighan and Ritchie, sections A7.19 and A12.5
<P>
<BR>

<H2>Theory of Operation</H2>
          The only unusual feature of this grammar is the
          interposition of a token called "nonzero" to avoid division
          by zero. Otherwise the grammar is a conventional expression
          grammar.
<P>
          The parser is implemented as an event driven parser. The
          initializer is <tt>init_ex()</tt>. The parser itself is
          <tt>ex()</tt>. The
          parser has been interfaced to the rest of the program by a
          class definition, <tt>expression_evaluator</tt>.
<P>
          The class definition for <tt>expression_evaluator</tt> is given in
          <tt>mpp.h</tt>. Each instance of the class has its own parser control
          block. Therefore the parser makes all of its references
          indirectly through a pointer, <tt>ex_pcb</tt>. Whenever it is
          necessary to invoke <tt>init_ex()</tt> or <tt>ex()</tt>,
          therefore, it is
          necessary first to make sure <tt>ex_pcb</tt> is correctly set.
<P>
          Input to the parser consists of tokens as defined in
          <tt>token.h</tt>. Since the input does not consist of simple
          characters, the <b>input values</b> switch is set. The input
          procedures store the full token into the input_value field
          of the pcb and the id field into input_code.

<P>

<BR>


<IMG ALIGN="bottom" SRC="../../images/rbline6j.gif" ALT="----------------------"
      WIDTH=1010 HEIGHT=2 >
<P>
<IMG ALIGN="right" SRC="../../images/pslrb6d.gif" ALT="Parsifal Software"
                WIDTH=181 HEIGHT=25>
<BR CLEAR="right">

<P>
Back to :
<A HREF="../../index.html">Index</A> |
<A HREF="index.html">Macro preprocessor overview</A>

<P>
<ADDRESS><FONT SIZE="-1">
                  AnaGram parser generator - examples<BR>
                  Expression Evaluator - Macro preprocessor and C Parser <BR>
                  Copyright &copy; 1993-1999, Parsifal Software. <BR>
                  All Rights Reserved.<BR>
</FONT></ADDRESS>

</BODY>
</HTML>