Index of /~bkessler/sanskrit-thesis/prog/rules

      Name                    Last modified       Size  Description

[DIR] Parent Directory 25-Jul-2004 18:33 - [TXT] Makefile 25-Jul-2004 11:06 7k [TXT] attribute.c 25-Jul-2004 11:06 1k [TXT] attribute.h 25-Jul-2004 11:06 1k [TXT] avm.c 25-Jul-2004 11:06 1k [TXT] avm.h 25-Jul-2004 11:06 1k [TXT] factor.c 25-Jul-2004 11:06 6k [TXT] factor.h 25-Jul-2004 11:06 4k [TXT] feature.c 25-Jul-2004 11:06 2k [TXT] feature.h 25-Jul-2004 11:06 2k [TXT] indexedAVM.c 25-Jul-2004 11:06 1k [TXT] indexedAVM.h 25-Jul-2004 11:06 1k [TXT] item.c 25-Jul-2004 11:06 3k [TXT] item.h 25-Jul-2004 11:06 2k [TXT] plainSignedFeature.c 25-Jul-2004 11:06 1k [TXT] plainSignedFeature.h 25-Jul-2004 11:06 1k [TXT] print.c 25-Jul-2004 11:06 1k [TXT] print.h 25-Jul-2004 11:06 1k [TXT] readRulesLex-epilog 25-Jul-2004 11:06 1k [TXT] readRulesLex-prolog 25-Jul-2004 11:06 1k [TXT] readRulesYacc.h 25-Jul-2004 11:06 1k [TXT] readRulesYacc.y 25-Jul-2004 11:06 7k [TXT] rule.c 25-Jul-2004 11:06 2k [TXT] rule.h 25-Jul-2004 11:06 2k [TXT] ruleSystem.c 25-Jul-2004 11:06 1k [TXT] ruleSystem.h 25-Jul-2004 11:06 1k [TXT] rules.c 25-Jul-2004 11:06 2k [TXT] rules.h 25-Jul-2004 11:06 1k [TXT] sign.c 25-Jul-2004 11:06 2k [TXT] sign.h 25-Jul-2004 11:06 2k [TXT] xduceRules 25-Jul-2004 11:06 39k [TXT] xduceRules.c 25-Jul-2004 11:06 1k

# -*- mode:     Fundamental -*- -------------------------------------------- #
# File:         rules/README
# Description:  Describes the rules/ directory
# Author:       Brett Kessler
# Created:       3-May-92
# Modified:     Sun May  3 16:08:26 1992 (Brett Kessler)
# Language:     English
##############################################################################

The rules/ directory builds the programme xduceRules, which reads the RULES
file and creates the code fragment ../frag/rules.c.  See ../README for a
description of the RULES file.  The rules.c file is a C expression which
builds the content of the RULES file as one data object which can be 
loaded without a special parser and be easily manipulated by the C
programme.  All features, segments, and lexical attributes are managed
internally as numeric IDs rather than as names.

The data types in this directory, needed for reading and transducing
the RULES file, are not much different from the output datatypes
written in rules.c and used by derive in the actual application of the
rules.  One consistent difference, however, is that the later programme
generally does not traffic in lists but in arrays, which are more
efficient when one knows in advance the number of elements to be dealt
with.  So many of these modules, instead of writing output code to
reconstruct lists, write variable length argument lists introduced by
the count of the objects in the original list; implementation code on
the other end will allocate an array of the necessary size (as
specified by the first argument) then read the rest of the arguments
into that array, one by one.

Another important difference is that whereas this parser builds up three
data objects faithful to the rule description "source -> change / environment",
the derive programme finds it more convenient to treat the entire
structural description as a sequential unit, where the source is described
inside the environment string, delimited by special flags that mark the
start and end of the substring that needs to be changed if the entire
description is satisfied.  Some of the print routines therefore pass this
source around as anargument called "focus", so that when the environment
bar "__" is encountered in an environment, the source can be substituted
in line, with appropriate delimiters.

The overall structure of this code is as follows.  xduceRules.c is the
main implementation module, which invokes the parser to read RULES on
standard input, then passes the returned rule system structure on to
the RuleSystem module to print itself out as C source code on the
../frag/rules.c file.  The interface to the parser is readRulesYacc.h.
The actual parser is readRulesYacc.y.  It includes readRulesLex.c to
tokenize the RULES file; this is compiled from readRulesLex.l, which itself
is generated by concatenating readRulesLex-prolog, which describes the tokens
unique to the RULES file, with the Lex fragments in frag/ (featuresLex,
segmentsLex, attributesLex), which are generated by other transducers,
and the readRules-Lex-epilog file.  Most of the rest of the files are
declaration (.h) and implementation (.c) files for the data types implicit
in the RULES file.  These are: ruleSystem.*, which portrays the entire
RULES file; rules.*, which represents the RULES section (the suite of rules);
rule.*, which is a single rule; item.*, which is an entire pattern (the three
parts of a rule, as well as the ONSETS declarations, are each Items);
factor.*, which is any of a large number of things that can appear as
top-level constituents in an item, among them avm.*, which is a feature
bundle, and indexedAVM.*, which is an AVM with an identity index; 
feature.*, which are the top-level elements in an AVM (either a single
plainSignedFeature.* or a list of them, denoting alternatives); sign.*,
which is the sign on a plain signed feature (+ or - or an alpha variable);
and attribute.*, which is a lexical attribute (which gets attached to the
word boundary following the word in question).   The module print.*
contains a global variable helping the print functions keep track of
indentationlevels in rules.c, promoting what legibility is possible in
a 2243-line C expression.

To rebuild this directory, type `make`.

##############################################################################
##                                End of README
##############################################################################