Affix grammar explained

An affix grammar is a two-level grammar formalism used to describe the syntax of languages, mainly computer languages, using an approach based on how natural language is typically described.[1]

The formalism was invented in 1962 by Lambert Meertens while developing a grammar for generating English sentences.[2] Meertens also applied affix grammars to the description and composition of music, and obtained a special prize from the jury at the 1968 International Federation for Information Processing (IFIP) Congress in Edinburgh for his computer-generated string quartet, Quartet No. 1 in C major for 2 violins, viola and violoncello, based on the first non-context-free affix grammar.[3] [4] The string quartet was published in 1968, as Mathematical Centre Report MR 96.[5]

The grammatical rules of an affix grammar are those of a context-free grammar, except that certain parts in the nonterminals (the affixes) are used as arguments. If the same affix occurs multiple times in a rule, its value must agree, i.e. it must be the same everywhere. In some types of affix grammar, more complex relationships between affix values are possible.

Example

We can describe an extremely simple fragment of English in the following manner:

SentenceSubject Predicate

SubjectNoun

PredicateVerb Object

ObjectNoun

Noun → John

Noun → Mary

Noun → children

Noun → parents

Verb → like

Verb → likes

Verb → help

Verb → helps

This context-free grammar describes simple sentences such as

John likes children

Mary helps John

children help parents

parents like John

With more nouns and verbs, and more rules to introduce other parts of speech, a large range of English sentences can be described; so this is a promising approach for describing the syntax of English.

However, the given grammar also describes sentences such as

John like children

children helps parents

These sentences are wrong: in English, subject and verb have a grammatical number, which must agree.

An affix grammar can express this directly:

SentenceSubject + number Predicate + number

Subject + numberNoun + number

Predicate + numberVerb + number Object

ObjectNoun + number

Noun + singular → John

Noun + singular → Mary

Noun + plural → children

Noun + plural → parents

Verb + singular → likes

Verb + plural → like

Verb + singular → helps

Verb + plural → help

This grammar only describes correct English sentences, although it could be argued that

John likes Johnis still incorrect and should instead read

John likes himself

This, too, can be incorporated using affixes, if the means of describing the relationships between different affix values are powerful enough. As remarked above, these means depend on the type of affix grammar chosen.

Types

In the simplest type of affix grammar, affixes can only take values from a finite domain, and affix values can only be related through agreement, as in the example.Applied in this way, affixes increase compactness of grammars, but do not add expressive power.

Another approach is to allow affixes to take arbitrary strings as values and allow concatenations of affixes to be used in rules. The ranges of allowable values for affixes can be described with context-free grammar rules. This produces the formalism of two-level grammars, also known as Van Wijngaarden grammars or 2VW grammars. These have been successfully used to describe complicated languages, in particular, the syntax of the Algol 68 programming language. However, it turns out that, even though affix values can only be manipulated with string concatenation, this formalism is Turing complete; hence, even the most basic questions about the language described by an arbitrary 2VW grammar are undecidable in general.

Extended Affix Grammars, developed in the 1980s, are a more restricted version of the same idea. They were mainly applied to describe the grammar of natural language, e.g. English.

Another possibility is to allow the values of affixes to be computed by code written in some programming language. Two basic approaches have been used:

Notes and References

  1. Koster, Cornelis HA. "Affix grammars for natural languages." Attribute Grammars, Applications and Systems. Springer, Berlin, Heidelberg, 1991.
  2. Koster . C. H. A. . Cornelis H. A. Koster . 1965 . On the construction of ALGOL-procedures for generating, analysing and translating sentences in natural languages . . MR72 .
  3. Kassler . Michael . 1969 . Report from Edinburgh . 7 . 2 . 175–177 . 10.2307/832302 . Perspectives of New Music. 832302. .
  4. http://repository.cwi.nl/search/fullrecord.php?publnr=9184 Quartet No. 1 in C major for 2 violins, viola and violoncello
  5. Meertens . Lambert . Lambert Meertens . 1968 . Quartet no. 1 in C major for 2 violins, viola and violoncello . . MR96 .