view doc/misc/html/examples/index.html @ 7:57b2cc9b87f7

Use memcpy instead of strncpy when we know the length anyway. Modern gcc seems to think it knows how to detect misuse of strncpy, but it's wrong (in fact: very, very wrong) and the path of least resistance is to not try to fight with it.
author David A. Holland
date Mon, 30 May 2022 23:47:52 -0400
parents 13d2b8934445
children
line wrap: on
line source

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>AnaGram Examples</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  >

<BR CLEAR="all">

<H1>AnaGram Examples</H1>

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

<H2>Introduction</H2>
<P>
          The <tt>examples</tt> directory contains a number of subdirectories,
          each of which contains one or more examples of the use of
          AnaGram. These examples vary from trivial to moderately
          complex.
<P>
          The purpose of these examples is twofold: to provide a quick
          introduction to AnaGram, and to suggest methods of using
          AnaGram to solve problems. The examples are open source, with a
	  zlib-type license, and thus provided as is,
          with no guarantees of any sort.  You may freely copy
          portions of these examples for your own use. However, in
          doing so, you take on the responsibility of verifying their
          performance and reliability.
<P>
          Some of the examples provided use C; others use C++. Some
          of the C++ examples make use of an old
          <A HREF="../oldclasslib/index.html">class library</A>, found
          in the <tt>oldclasslib</tt> directory of the AnaGram
          distribution. This class library is deprecated and is
          expected to be removed in a future release of AnaGram, once
          the examples have been migrated away from it. It too is open
          source; however, using it is not recommended.
<P>
          The <tt>examples</tt> directory also contains the file
          <tt>sbb-doc.txt</tt>.
          This file contains productions and explanations for a number of
          <A HREF="sbb-doc.html">syntactic building blocks</A>. These
          are commonly used
          syntactic constructs which appear over and over in AnaGram
          programs. You may prefer to read this material in its HTML
          form or as the
          Syntactic Building Blocks appendix of the AnaGram User's Guide, but
          <tt>sbb-doc.txt</tt> is easier to use if you wish to copy
          parts of it
          into your own grammars.
<P>
<BR>

<H2>Getting Started with the Examples</H2>
          To get started with AnaGram examples, you should begin by looking
          at <tt>ffcalc</tt>, <A HREF=ffcex.html>annotated</A> in the
          <A HREF=../start.html>Getting Started</A> document. The
          source file is found in the <tt>examples/ffcalc</tt> directory.
<P>
          If you are already quite familiar with syntax directed
          parsing, you may need to do little more than glance at
          <tt>ffcalc</tt> to begin using AnaGram effectively.
<P>
          Otherwise, you should look at the examples in <tt>hw</tt>
          and <tt>fc</tt>, and
          read their documentation. These examples provide a tutorial
          introduction to AnaGram through a graded sequence of
          examples.
<P>
          The remaining examples are provided largely as illustrations
          of how to use AnaGram to deal with particular, practical
          problems.
<P>
          You can use this page as a starting point to navigate through
          the hypertext documentation for the examples and class
          libraries.
<P>
          These examples only begin to illustrate the power of
          AnaGram. Do not overlook the AnaGram User's Guide. It will
          show you even more things you can do with AnaGram.
<P>
<BR>


<H2><A HREF="hw.html">HW</A></H2>

          The <tt>hw</tt> directory contains two versions of the traditional
          "Hello, world!" program. One version, <tt>hw1.syn</tt>, uses C for
          its reduction procedure.  The other, <tt>hw2.syn</tt>, uses C++.
          Both programs print "Hello, world!" These programs are
          utterly trivial, but useful for getting started with the
          mechanics of using AnaGram.
<P>
<BR>

<H2><A HREF="ffcalc.html">FFCALC</A>
or <A HREF=ffcex.html>annotated version</A></H2>
          A four function calculator is a traditional example
          for parser generators. The <tt>ffcalc</tt> directory contains two
          four function calculator examples, <tt>ffcalc.syn</tt> and
          <tt>ffcalcx.syn</tt>. <tt>ffcalc.syn</tt> implements
          expression syntax
          using the conventional approach. <tt>ffcalcx.syn</tt> is
          functionally equivalent, but uses a
          deliberately ambiguous grammar with precedence declarations
          to resolve the conflicts.
<P>
<BR>

<H2><A HREF="fc.html">FC</A></H2>

<!-- "graded"? -->
          The <tt>fc</tt> directory contains six graded Fahrenheit to Celsius
          conversion programs. These programs introduce a number of
          the most important features of AnaGram. The document is
          designed to be a tutorial, to lead you into using AnaGram by
          simple steps. It includes an example of how to find and
          fix the conflicts in an ambiguous grammar. All of the <tt>fc</tt>
          examples use C.
<P>
<BR>

<H2><A HREF="rcalc.html">RCALC</A></H2>
          <tt>rcalc.syn</tt> is a simple four function desk calculator that
          takes its input and displays its output using Roman
          numerals. <tt>rcalc</tt> uses C.
<P>
<BR>

<H2><A HREF="dsl.html">DSL</A></H2>
           <tt>dsl.syn</tt> is a DOS script language, used in the past to
           create an install program for AnaGram. It is now quite obsolete
           but does illustrate some features of AnaGram.  <tt>dsl</tt> is
           largely composed of grammar elements copied from other
           programs. <tt>dsl</tt> uses C++.
<P>
<BR>

<H2><A HREF="mpp/index.html">MPP</A></H2>
          The <tt>mpp</tt> directory contains a complete, working C macro
          preprocessor together with your choice of two C grammars.
          The preprocessor uses four distinct AnaGram grammars and
          illustrates many of the ways you can interface parsers to
          other modules. <tt>mpp</tt> uses C++.
	<!--
	  For an overview of the macro
          preprocessor and how it works, read the <tt>README</tt> file
          in <tt>mpp</tt>.
	-->
          Each grammar and each support module is separately described
          in its own documentation file.
</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">
                  AnaGram parser generator - examples<BR>
                  AnaGram Examples<BR>
                  Copyright &copy; 1993-1999, Parsifal Software. <BR>
                  All Rights Reserved.<BR>
</FONT></ADDRESS>

</BODY>
</HTML>