Unrestricted grammar

Unrestricted grammar

In formal language theory, an "unrestricted grammar" is a formal grammar on which no restrictions are made on the left and right sides of the grammar's productions. This is the most general class of grammars in the Chomsky–Schützenberger hierarchy, and can recognize arbitrary recursively enumerable languages.

Formal definition

An unrestricted grammar is a formal grammar G = (N, Sigma, P, S), where N is a set of nonterminal symbols, Sigma is a set of terminal symbols, N and Sigma are disjoint (actually, this is not strictly necessary, because unrestricted grammars make no real distinction between nonterminal and terminal symbols, the designation exists purely so that one knows when to stop when trying to generate sentential forms of the grammar), P is a set of production rules of the form alpha o eta where alpha and eta are strings of symbols in N cup Sigma and alpha is not the empty string, and S in N is a specially designated start symbol. As the name implies, there are no real restrictions on the types of production rules that unrestricted grammars can have.

Unrestricted grammars and Turing machines

It may be shown that unrestricted grammars characterize the recursively enumerable languages. This is the same as saying that for every unrestricted grammar G there exists some Turing machine capable of recognizing L(G) and vice-versa. Given an unrestricted grammar, such a Turing machine is simple enough to construct, as a two-tape nondeterministic Turing machine. The first tape contains the input word w to be tested, and the second tape is used by the machine to generate sentential forms from G. The Turing machine then does the following:

# Start at the left of the second tape and repeatedly choose to move right or select the current position on the tape.
# Nondeterministically choose a production eta o gamma from the productions in G.
# If eta appears at some position on the second tape, replace eta by gamma at that point, possibly shifting the symbols on the tape left or right depending on the relative lengths of eta and gamma (e.g. if eta is longer than gamma, shift the tape symbols left).
# Compare the resulting sentential form on tape 2 to the word on tape 1. If they match, then the Turing machine accepts the word. If they don't go back to step 1.

It is easy to see that this Turing machine will generate all and only the sentential forms of G on its second tape after the last step is executed an arbitrary number of times, thus the language L(G) must be recursively enumerable.

The reverse construction is also possible. Given some Turing machine, it is possible to create an unrestricted grammar.

Computational properties

As might be expected from the equivalence of unrestricted grammars and Turing machines, the decision problem of whether a given string s belongs to the language of some unrestricted grammar is in general undecidable.

It is perfectly possible to create a universal unrestricted grammar capable of accepting any other unrestricted grammar's language given a description of the language, just as it is possible to create a universal Turing machine, so it would in theory be possible to build a programming language based on unrestricted grammars.

References

* (the Cinderella book)

ee also

* Turing machine
* Lambda calculus
* String rewriting


Wikimedia Foundation. 2010.

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

Look at other dictionaries:

  • 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

  • Context-free grammar — In formal language theory, a context free grammar (CFG) is a formal grammar in which every production rule is of the form V → w where V is a single nonterminal symbol, and w is a string of terminals and/or nonterminals (w can be empty). The… …   Wikipedia

  • Controlled grammar — Controlled grammars[1] are a class of grammars that extend, usually, the context free grammars with additional controls on the derivations of a sentence in the language. A number of different kinds of controlled grammars exist, the four main… …   Wikipedia

  • Context-sensitive grammar — A context sensitive grammar (CSG) is a formal grammar in which the left hand sides and right hand sides of any production rules may be surrounded by a context of terminal and nonterminal symbols. Context sensitive grammars are more general than… …   Wikipedia

  • Constraint Grammar — (CG) is a methodological paradigm for Natural language processing (NLP). Linguist written, context dependent rules are compiled into a grammar that assigns grammatical tags ( readings ) to words or other tokens in running text. Typical tags… …   Wikipedia

  • Prince Henry's Grammar School, Otley — Prince Henry s Grammar School Established 1607 Type Voluntary Controlled Comprehensive Headteacher Ms Janet Sheriff Specialism Language College Location Farnley Lane …   Wikipedia

  • Discontinuous-constituent phrase structure grammar — (DCPSG) (distinct from Discontinuous Phrase Structure Grammar/DPSG) is a formalism for describing discontinuous phrase structures in natural language, such as verb phrases in VSO languages. The formalism was introduced in the slightly more… …   Wikipedia

  • Minimalist grammar — Minimalist grammars are a class of formal grammars that aim to provide a more rigorous, usually proof theoretic, formalization of Chomskyan Minimalist program than is normally provided in the mainstream Minimalist literature. A variety of… …   Wikipedia

  • Deterministic context-free grammar — In formal grammar theory, the deterministic context free grammars (DCFGs) are a proper subset of the context free grammars. The deterministic context free grammars are those a deterministic pushdown automaton can recognize. A DCFG is the finite… …   Wikipedia

  • Sacred Heart Grammar School — Having recently celebrated its 75th anniversary, the Sacred Heart Grammar School is one of Northern Ireland s top grammar schools with 875 students and 52 full time teachers. The school is housed on a state of the art complex at Ashgrove, Newry a …   Wikipedia

Share the article and excerpts

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