Setting and getting values of grammatical and semantic "features" during parsing with ASDParser

Copyright 2008  James A. Mason

    To represent semantic values or syntactic features (e.g., singular vs. plural of nouns or verbs, or the case of nouns) during a parse, ASDParser provides a mechanism for the Java functions which are named in semantic action and semantic value augmentations of an ASD grammar to set and access pairs of "features" and "values".  A feature can be any string, and its corresponding value can be any Java object..  ASDParser provides the following instance functions to set and access feature values and to access semantic values of nodes in a phrase structure.  At each stage in the parsing process, the parser maintains a set of feature-value pairs for the current subphrase being parsed at the top level of the phrase structure.  That subphrase corresponds to the current search path through a component of the grammar.
The functions get and valueOf are identical; they just provide alternative names for getting the current value of a feature.  In addition to the foregoing instance functions of ASDParser, the class ASDPhraseNode provides a method
to return the semantic value of a node in the phrase structure.  Illustrations of uses of these various instance functions are provided in  the example Numerals.java, in the functions named in the semantic action and semantic value fields of its associated ASD grammar cardinal.grm (shown in graphical form in cardinal.jpg).

last modified 2008 Mar 17