diff doc/misc/html/examples/rcalc.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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/misc/html/examples/rcalc.html	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,116 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<TITLE>Roman Numeral Calculator</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>
+<P>
+<IMG ALIGN="bottom" SRC="../images/rbline6j.gif" ALT="----------------------"
+        WIDTH=1010 HEIGHT=2  >
+<P>
+
+<H1>Roman Numeral Calculator</H1>
+<IMG ALIGN="bottom" SRC="../images/rbline6j.gif" ALT="----------------------"
+        WIDTH=1010 HEIGHT=2  >
+<P>
+<H2>Introduction</H2>
+<P>
+          <tt>rcalc</tt> is a simple four function desk calculator program
+          which accepts its input and displays its output in Roman
+          numerals. The source code for <tt>rcalc</tt> is completely contained
+          in the file <tt>rcalc.syn</tt>.
+
+          <tt>rcalc</tt> illustrates the following AnaGram features:
+<UL>
+<LI>       pointer input </LI>
+<LI>       <tt>SYNTAX_ERROR</tt> macro </LI>
+<LI>       context tracking </LI>
+</UL>
+<P>
+
+<H2>     Building RCALC </H2>
+          To build a working copy of <tt>rcalc</tt>, you need to carry out the
+          following steps:
+<UL>
+<LI>       1.  Run Anagram and build a parser for <tt>rcalc</tt> </LI>
+<LI>       2.  Using your C compiler, compile and link <tt>rcalc.c</tt>. </LI>
+</UL>
+<P>
+
+<H2>     Running RCALC </H2>
+          When you run <tt>rcalc</tt> (from the command line), it will
+          display a '<CODE>#</CODE>' prompt. Type an
+          arithmetic expression in Roman numerals, using either upper
+          or lower case letters. <tt>rcalc</tt> will accept addition,
+          subtraction, multiplication and division operations, as well
+          as unary negation, using integer arithmetic. It respects the
+          conventional order of operations. You may use spaces and tabs
+          freely when you type the expression and parentheses to
+          override the natural order of computation. You may use the
+          word <tt>NIHIL</tt> to represent zero.
+<P>
+          When you have typed your expression, press Enter. <tt>rcalc</tt> will
+          parse your expression, and if it has no syntax errors, <tt>rcalc</tt>
+          will display the result in Roman numerals. If there is a
+          syntax error, or if you tried to divide by zero, <tt>rcalc</tt> will
+          display a diagnostic message, showing the location of the
+          error. You may exit the program by pressing Enter at the
+          prompt.
+
+
+<BR><BR><BR>
+<H2>     Theory of Operation </H2>
+          <tt>rcalc</tt>, like Gaul, is divided into three parts: reading
+          input, interpreting Roman numerals, and evaluating
+          expressions.
+<P>
+          In <tt>rcalc</tt>, the main program, written in C, displays a prompt,
+          reads a line of input, calls the parser to interpret it, and
+          loops until it encounters end of file. The <tt>rcalc</tt> parser uses
+          "pointer input" to parse a string already in memory. The
+          main program needs only to set the "pointer" field in the
+          parser control block to point to the string before calling
+          the parser.
+<P>
+          The syntax for the Roman numerals consists of
+          straightforward enumeration of the possibilities. At every
+          level but the thousands, there are a number of special
+          cases, and at every level including the thousands there is
+          the possibility of repetition. The major complicating factor
+          is that every field, from the thousands to the units, is
+          optional, but at least one field has to be present.
+<P>
+          The expression logic is simply the conventional syntax for
+          the basic arithmetic functions.
+</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>
+<P>
+<ADDRESS><FONT SIZE="-1"><BR><BR>
+                  AnaGram parser generator - examples<BR>
+                  Roman Numeral Calculator <BR>
+                  Copyright (c) MCMXCIII-MCMXCIX, Parsifal Software. <BR>
+                  All Rights Reserved. <BR>
+</FONT></ADDRESS>
+
+</BODY>
+</HTML>
+
+