Adaptive grammar


An adaptive grammar is a formal grammar that explicitly provides mechanisms within the formalism to allow its own production rules to be manipulated.

Overview

John N. Shutt defines adaptive grammar as a grammatical formalism that allows rule sets to be explicitly manipulated within a grammar. Types of manipulation include rule addition, deletion, and modification.

Early history

The first description of grammar adaptivity in the literature is generally taken to be in a paper by Alfonso Caracciolo di Forino published in 1963. The next generally accepted reference to an adaptive formalism came from Wegbreit in 1970 in the study of extensible programming languages, followed by the dynamic syntax of Hanford and Jones in 1973.

Collaborative efforts

Until fairly recently, much of the research into the formal properties of adaptive grammars was uncoordinated between researchers, only first being summarized by Henning Christiansen in 1990 in response to a paper in ACM SIGPLAN Notices by Boris Burshteyn. The Department of Engineering at the University of São Paulo has its , specifically focusing on research and practice in adaptive technologies and theory. The LTA also maintains a page naming researchers in the field.

Terminology and taxonomy

While early efforts made reference to dynamic syntax and extensible, modifiable, dynamic, and adaptable grammars, more recent usage has tended towards the use of the term adaptive. Iwai refers to her formalism as adaptive grammars, but this specific use of simply adaptive grammars is not typically currently used in the literature without name qualification. Moreover, no standardization or categorization efforts have been undertaken between various researchers, although several have made efforts in this direction.

The Shutt classification (and extensions)

Shutt categorizes adaptive grammar models into two main categories:
Jackson refines Shutt's taxonomy, referring to changes over time as global and changes over space as local, and adding a hybrid time-space category:
Adaptive formalisms may be divided into two main categories: full grammar formalisms, and adaptive machines, upon which some grammar formalisms have been based.

Adaptive grammar formalisms

The following is a list of grammar formalisms that, by Shutt's definition above, are considered to be adaptive grammars. They are listed in their historical order of first mention in the literature.

Extensible context-free grammars (Wegbreit)

Described in Wegbreit's doctoral dissertation in 1970, an extensible context-free grammar consists of a context-free grammar whose rule set is modified according to instructions output by a finite state transducer when reading the terminal prefix during a leftmost derivation. Thus, the rule set varies over position in the generated string, but this variation ignores the hierarchical structure of the syntax tree. Extensible context-free grammars were classified by Shutt as imperative.

Christiansen grammars (Christiansen)

First introduced in 1985 as Generative Grammars and later more elaborated upon, Christiansen grammars are an adaptive extension of attribute grammars. Christiansen grammars were classified by Shutt as declarative.
The redoubling language is demonstrated as follows:
G> → G↑w>
where w-rule =
G’> → w
G↑chw> → G↑ch> G↑w>
> → <ε>
→ a

Bottom-up modifiable grammars, top-down modifiable grammars, and USSA (Burshteyn)

First introduced in May 1990 and later expanded upon in December 1990, modifiable grammars explicitly provide a mechanism for the addition and deletion of rules during a parse. In response to the ACM SIGPLAN Notices responses, Burshteyn later modified his formalism and introduced his adaptive Universal Syntax and Semantics Analyzer in 1992. These formalisms were classified by Shutt as imperative.

Recursive adaptive grammars (Shutt)

Introduced in 1993, Recursive Adaptive Grammars were an attempt to introduce a Turing powerful formalism that maintained much of the elegance of context-free grammars. Shutt self-classifies RAGs as being a declarative formalism.

Dynamic grammars (Boullier)

Boullier's dynamic grammars, introduced in 1994, appear to be the first adaptive grammar family of grammars to rigorously introduce the notion of a time continuum of a parse as part of the notation of the grammar formalism itself. Dynamic grammars are a sequence of grammars, with each grammar Gi differing in some way from other grammars in the sequence, over time. Boullier's main paper on dynamic grammars also defines a dynamic parser, the machine that effects a parse against these grammars, and shows examples of how his formalism can handle such things as type checking, extensible languages, polymorphism, and other constructs typically considered to be in the semantic domain of programming language translation.

Adaptive grammars (Iwai)

The work of Iwai in 2000 takes the adaptive automata of Neto further by applying adaptive automata to context-sensitive grammars. Iwai's adaptive grammars allow for three operations during a parse: ? query, + addition, and - deletion.

§-calculus (Jackson)

Introduced in 2000 and most fully discussed in 2006, the §-Calculus allows for the explicit addition, deletion, and modification of productions within a grammar, as well as providing for syntactic predicates. This formalism is self-classified by its creator as both imperative and adaptive, or, more specifically, as a time-space adaptive grammar formalism, and was further classified by others as being an analytic formalism.
The redoubling language is demonstrated as follows:
grammar ww ;
statements identify the points in the production R that modify the grammar explicitly. #phi represents a global modification and the #phi statement identifies a local modification. The #phi

Adaptive devices (Neto & Pistori)

First described by Neto in 2001, adaptive devices were later enhanced and expanded upon by Pistori in 2003.

Adapser (Carmi)

In 2002, Adam Carmi introduced an LALR-based adaptive grammar formalism known as Adapser. Specifics of the formalism do not appear to have been released.

Adaptive CFGs with appearance checking (Bravo)

In 2004, César Bravo introduced the notion of merging the concept of appearance checking with adaptive context-free grammars, a restricted form of Iwai's adaptive grammars, showing these new grammars, called Adaptive CFGs with Appearance Checking to be Turing powerful.

Adaptive machine formalisms

The formalisms listed below, while not grammar formalisms, either serve as the basis of full grammar formalisms, or are included here because they are adaptive in nature. They are listed in their historical order of first mention in the literature.
;Self-modifying finite state automata
;Adaptive automata