This is the directory containing the sources for sndawk. The manual
page is the file sndawk.1. The file DOC.ms is the paper presented at the
EUUG conference in Cambridge. To print it on a versatec do:
	tbl DOC.ms | eqn | pic | vtroff -ms

There is a Makefile, so normally the command make will make sndawk.
However you must probably change things in it to make it work. If you
have CARL and somewhere a file config.m4 you can edit the first line
of the file Makefile.m4 then run the command:
	m4 Makefile.m4 > Makefile

If you have not CARL you must turn off the flag -DCARL and eliminate the
library libcarl.a. (in the Makefile of course)

If you want to change something you must understand how this thing work.
Some history: I wrote a syntactic analysis programs generator based on the
week precedence grammers and a mini-sndawk for some courses at the
University. Then the program became more and more complicated and
now it's too late to rewrite it using yacc. LR(1) grammers are much
more powerful than week precedence ones, most of the sources are
commented in French and names are mixed French and English. Sorry...

Variables and terminals for the syntactic analysis (as for the lexical one)
are macros. Variables begin with "V" and terminals with "L". The list
is in the file lex.h. Variables are before the "%" sign. Then comes
terminals and after the sign "@" other macros. The lexical
analysis build a structure with fields like "typesymb" or "lexval".
For example if the "typesymb" is LRELOP (relational operator) the
"lexval" could be LT ("<") or LE ("<=").
The second field in some lines is for debugging. The real .h file is
called sndawk.lx.h and is built from lex.h with the awk script lex.awk.

The lexical analysis is done with lex. (no problem)

The week precedence grammer is in the file sndawk.gram. For obscure reasons
the right hand of a rule can have maximum 4 elements. Lines beginning with
"@" are rules. The first field is the left hand of the rule, the next 
ones the right hand. There cannot be empty right hand.

The file gram.c is source for the programs analgram and debug.
Analgram calculates the precedence relations and builds the file
precedence.c.
Debug does the same thing, but builds the file debuggram which is necessary
if you try to change the grammer and want to see what's wrong. (you must
type "make debuggram").

The lexical analysis builds a list of SYMBs. The syntactic analysis transforms
this list into a tree by transforming sub-lists into sub-trees. The function
precedence() return the precedence relation between two SYMBs. A sub-list
beginning with "<=." and ending with ">." is transformed into a sub-tree
in the function reduce(). The file reduce.c is built from red*.pseudo.c
with the awk script reduce.awk. The right hand of the rule to be reduced
is on lines beginning with "@". Than comes actions to be applied for
the rule. The macros used are defined in red.h

To debug the reduction type "make test". Then run test with the same
arguments as sndawk. You will see all the steps of the reduction.

The execution, evaluation of expressions etc... are much more clear so I will
not insist.
