
This is a simple interactive calculator based utilizing the Zebu
parser generator and driver.  Among other things, it illustrates the
use of RScheme as an interpreter rather than an interactive
environment of it's own.

To use this example, you must have the Zebu modules installed.
See <http://www.tkg.com/people/donovan/proj/rs/zebu/> for instructions
and locations.

You must also have RScheme 0.6, level 1.4 or later installed, and
be in your path as `rs'

Then, you should need only type make:

    kali:calc> make
    cc makex.c -o makex
    rs +zebu_gen -e '(compile-lalr1-grammar "syntax.grm" "syntax.tab")' -exit
    RScheme (v0.6.1/4, 95.12.13)
    Copyright (C) 1995 Donovan Kolbly <donovan@tkg.com>
    RScheme comes with ABSOLUTELY NO WARRANTY.
    type ",warranty" for details; type ",help" for some help
    WARNING: define already bound to #[<special-form> define]
    WARNING: assert already bound to #[<macro> assert]
    reading grammar from syntax.grm, start symbols is: <file>
    28 productions,  30 symbols
    <expr-list> derives the empty string
    <semicolon-opt> derives the empty string
    ............................................44 item sets
    ............................................
    ............................................
    Dumping parse tables to syntax.tabexiting...
    rs main.scm scanner.scm -c calc
    RScheme (v0.6.1/4, 95.12.13)
    Copyright (C) 1995 Donovan Kolbly <donovan@tkg.com>
    RScheme comes with ABSOLUTELY NO WARRANTY.
    type ",warranty" for details; type ",help" for some help
    WARNING: define already bound to #[<special-form> define]
    WARNING: assert already bound to #[<macro> assert]
    saving to image: calc
    chmod +x calc
    makex calc `which rs`
    kali:calc> 

calc is now a standalone executable file.

    kali:calc> mv calc /tmp
    kali:calc> cd /tmp
    kali:tmp> calc
    ? define x = cons(1,2);
    ok
    ? x;
    (1 . 2)
    ? x . car;
    1
    ? car(x);
    1
    ? 

The '?' is the calculator prompt.


Notes
=====
(1) Expressions must be followed by ';' or EOF before the parser will 
    reduce them.

(2) The underlying scanner is that of RScheme, altered at runtime
    to understand '[' and ']', and to handle ';' differently (a delimiter
    instead of a comment).  However, the handling of '.' is not
    changed; hence the spaces surrounding the dot above.  This
    would be fixed in a serious scanner.

(3) The only purpose of 'makex.c' is to install a unixesque interpreter
    specification line -- that is, a "#!" line -- in the compiled
    image file.  The image file format is specifically designed to
    allow room for this line -- there's 128 characters of blanks at the
    beginning that isn't used.  makex.c is here because I didn't want to
    depend on the syscalls package being available and I couldn't figure
    out how to do it using stdio.

