Affix grammar

Affix grammar

An affix grammar is a kind of formal grammar; it is used to describe the syntax of languages, mainly computer languages, using an approach based on how natural language is typically described.

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:

"Sentence" → "Subject" "Predicate" "Subject" → "Noun" "Predicate" → "Verb" "Object" "Object" → "Noun" "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: "Sentence → Subject+number Predicate+number" "Subject+number → Noun+number" "Predicate+number → Verb+number Object" "Object → Noun+number" "Noun+"singular → John "Noun+"singular → Mary "Noun+"plural → children "Noun+"plural → parents "Verb+"singular → like "Verb+"plural → likes "Verb+"singular → help "Verb+"plural → helps

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 of affix grammars

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:
* In attribute grammars, the affixes (called attributes) can take values from arbitrary domains (e.g. integer or real numbers, complex data structures) and arbitrary functions can be specified, written in a language of choice, to describe how affix values in rules are derived from each other.
* In CDL (the Compiler Description Language) and its successor CDL2, developed in the 1970s, fragments of source code (usually in assembly language) can be used in rules instead of normal right-hand sides, allowing primitives for input scanning and affix value computations to be expressed directly. Designed as a basis for practical compiler construction, this approach was used to write compilers, and other software, e.g. a text editor.


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Affix grammar over a finite lattice — In linguistics, the affix grammars over a finite lattice (AGFL) formalism is a notation for context free grammars with finite set valued features, acceptable to linguists of many different schools.The AGFL project aims at the development of a… …   Wikipedia

  • Extended Affix Grammar — (EAG) is a formalism developed by Marc Seutter for describing both the context free syntax and the context sensitive syntax of programming languages.EAG is a member of the family of two level grammars. They are very closely related to two level… …   Wikipedia

  • Grammar framework — In theoretical linguistics, the following fundamental approaches towards constructing grammar frameworks for natural languages are distinguished:*Generative grammar: algorithmic (phrase structure grammars) **Transformational grammar (1960s)… …   Wikipedia

  • Grammar — is the field of linguistics that covers the rules governing the use of any given natural language. It includes morphology and syntax, often complemented by phonetics, phonology, semantics, and pragmatics. Each language has its own distinct… …   Wikipedia

  • affix — ► VERB ▪ attach or fasten to something else. ► NOUN Grammar ▪ an addition to a word in order to modify its meaning or create a new word. DERIVATIVES affixation noun. ORIGIN Latin affixare, from figere to fix …   English terms dictionary

  • affix — affixable, adj. affixal /a fik seuhl/, affixial /a fik see euhl/, adj. affixer, n. affixment, n. v. /euh fiks /; n. /af iks/, v.t. 1. to fasten, join, or attach (usually fol. by to): to affix stamps to a letter …   Universalium

  • affix — verb (t) /əˈfɪks / (say uh fiks) 1. (sometimes followed by to) to fix; fasten, join, or attach: to affix stamps to a letter. 2. to impress (a seal or stamp). 3. to place (one s signature) on a document. 4. to attach (blame, reproach, ridicule,… …  

  • affix — verb ə fɪks attach or fasten to something else. noun afɪks Grammar an addition to the base form or stem of a word that modifies its meaning or creates a new word. Derivatives affixation noun Origin ME: from OFr. affixer or med. L. affixare,… …   English new terms dictionary

  • affix — v 1. connect, attach, fix, conjoin, subjoin; join, fasten, unite, tie, bind; tack, nail, staple, pin, hook. 2. add, add on, add to, annex, append, adjoin, Inf. tack on, Inf. hitch on, postfix; All Grammar. prefix, suffix, infix. 3. impress,… …   A Note on the Style of the synonym finder

  • Formal grammar — In formal semantics, computer science and linguistics, a formal grammar (also called formation rules) is a precise description of a formal language ndash; that is, of a set of strings over some alphabet. In other words, a grammar describes which… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”