<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.formulasearchengine.com/index.php?action=history&amp;feed=atom&amp;title=Blazed_grating</id>
	<title>Blazed grating - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://en.formulasearchengine.com/index.php?action=history&amp;feed=atom&amp;title=Blazed_grating"/>
	<link rel="alternate" type="text/html" href="https://en.formulasearchengine.com/index.php?title=Blazed_grating&amp;action=history"/>
	<updated>2026-05-30T02:06:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0-wmf.28</generator>
	<entry>
		<id>https://en.formulasearchengine.com/index.php?title=Blazed_grating&amp;diff=22399&amp;oldid=prev</id>
		<title>en&gt;Patrick87: Reverted 1 edit by Ay283 (talk): Remove promotional reference.</title>
		<link rel="alternate" type="text/html" href="https://en.formulasearchengine.com/index.php?title=Blazed_grating&amp;diff=22399&amp;oldid=prev"/>
		<updated>2014-01-10T23:10:08Z</updated>

		<summary type="html">&lt;p&gt;Reverted 1 edit by &lt;a href=&quot;/wiki/Special:Contributions/Ay283&quot; title=&quot;Special:Contributions/Ay283&quot;&gt;Ay283&lt;/a&gt; (&lt;a href=&quot;/index.php?title=User_talk:Ay283&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:Ay283 (page does not exist)&quot;&gt;talk&lt;/a&gt;): Remove promotional reference.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In [[formal language theory]], a &amp;#039;&amp;#039;&amp;#039;grammar&amp;#039;&amp;#039;&amp;#039; (when the context is not given, often called a &amp;#039;&amp;#039;&amp;#039;formal grammar&amp;#039;&amp;#039;&amp;#039; for clarity) is a set of [[Production (computer science)|production  rule]]s for [[String (computer science)|strings]] in a [[formal language]]. The rules describe how to form strings from the language&amp;#039;s [[Alphabet (computer science)|alphabet]] that are valid according to the language&amp;#039;s [[syntax (programming languages)|syntax]]. A grammar does not describe the [[semantics|meaning of the strings]] or what can be done with them in whatever context—only their form.&lt;br /&gt;
&lt;br /&gt;
[[Formal language theory]], the discipline which studies formal grammars and languages, is a branch of applied [[mathematics]].  Its applications are found in [[theoretical computer science]], [[theoretical linguistics]], [[Formal semantics (logic)|formal semantics]], [[mathematical logic]], and other areas.&lt;br /&gt;
&lt;br /&gt;
A formal grammar is a set of rules for rewriting strings, along with a &amp;quot;start symbol&amp;quot; from which rewriting starts. Therefore, a grammar is usually thought of as a language generator. However, it can also sometimes be used as the basis for a &amp;quot;[[recognizer]]&amp;quot;&amp;amp;mdash;a function in computing that determines whether a given string belongs to the language or is grammatically incorrect. To describe such recognizers, formal language theory uses separate formalisms, known as [[automata theory]]. One of the interesting results of automata theory is that it is not possible to design a recognizer for certain formal languages.&lt;br /&gt;
&lt;br /&gt;
[[Parsing]] is the process of recognizing an utterance (a string in natural languages) by breaking it down to a set of symbols and analyzing each one against the grammar of the language.  Most languages have the meanings of their utterances structured according to their syntax&amp;amp;mdash;a practice known as [[compositional semantics]]. As a result, the first step to describing the meaning of an utterance in language is to break it down part by part and look at its analyzed form (known as its [[parse tree]] in computer science, and as its [[deep structure]] in [[generative grammar]]).&lt;br /&gt;
&lt;br /&gt;
== Introductory example ==&lt;br /&gt;
&lt;br /&gt;
A grammar mainly consists of a set of rules for transforming strings. (If it &amp;#039;&amp;#039;only&amp;#039;&amp;#039; consisted of these rules, it would be a [[semi-Thue system]].)  To generate a string in the language, one begins with a string consisting of only a single &amp;#039;&amp;#039;start symbol&amp;#039;&amp;#039;. The &amp;#039;&amp;#039;[[Production (computer science)|production rules]]&amp;#039;&amp;#039; are then applied in any order, until a string that contains neither the start symbol nor designated &amp;#039;&amp;#039;nonterminal symbols&amp;#039;&amp;#039; is produced. A production rule is applied to a string by replacing one occurrence of its left-hand side in the string by its right-hand side (&amp;#039;&amp;#039;cf.&amp;#039;&amp;#039; the operation of the theoretical [[Turing machine]]). The language formed by the grammar consists of all distinct strings that can be generated in this manner. Any particular sequence of production rules on the start symbol yields a distinct string in the language. If there are multiple ways of generating the same single string, the grammar is said to be [[ambiguous grammar|ambiguous]].&lt;br /&gt;
&lt;br /&gt;
For example, assume the alphabet consists of &amp;#039;&amp;#039;a&amp;#039;&amp;#039; and &amp;#039;&amp;#039;b&amp;#039;&amp;#039;, the start symbol is &amp;#039;&amp;#039;S&amp;#039;&amp;#039;, and we have the following production rules:&lt;br /&gt;
&lt;br /&gt;
: 1. &amp;lt;math&amp;gt;S \rightarrow aSb&amp;lt;/math&amp;gt;&lt;br /&gt;
: 2. &amp;lt;math&amp;gt;S \rightarrow ba&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then we start with &amp;#039;&amp;#039;S&amp;#039;&amp;#039;, and can choose a rule to apply to it. If we choose rule 1, we obtain the string &amp;#039;&amp;#039;aSb&amp;#039;&amp;#039;. If we then choose rule 1 again, we replace &amp;#039;&amp;#039;S&amp;#039;&amp;#039; with &amp;#039;&amp;#039;aSb&amp;#039;&amp;#039; and obtain the string &amp;#039;&amp;#039;aaSbb&amp;#039;&amp;#039;. If we now choose rule 2, we replace &amp;#039;&amp;#039;S&amp;#039;&amp;#039; with &amp;#039;&amp;#039;ba&amp;#039;&amp;#039; and obtain the string &amp;#039;&amp;#039;aababb&amp;#039;&amp;#039;, and are done. We can write this series of choices more briefly, using symbols: &amp;lt;math&amp;gt;S \Rightarrow aSb \Rightarrow aaSbb \Rightarrow aababb&amp;lt;/math&amp;gt;. The language of the grammar is then the infinite set &amp;lt;math&amp;gt;\{a^nbab^n | n \ge 0 \} = \{ba, abab, aababb, aaababbb, \dotsc \}&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;a^k&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; repeated &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; times (and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; in particular represents the number of times production rule 1 has been applied).&lt;br /&gt;
&lt;br /&gt;
== Formal definition ==&lt;br /&gt;
=== The syntax of grammars ===&lt;br /&gt;
In the classic formalization of generative grammars first proposed by [[Noam Chomsky]] in the 1950s,&amp;lt;ref name=&amp;quot;Chomsky1956&amp;quot;&amp;gt;{{Cite journal &lt;br /&gt;
 | author = Chomsky, Noam&lt;br /&gt;
 | title = Three Models for the Description of Language&lt;br /&gt;
 | journal = [[IRE Transactions on Information Theory]]&lt;br /&gt;
 | volume = 2 &lt;br /&gt;
 | issue = 2&lt;br /&gt;
 | pages = 113&amp;amp;ndash;123&lt;br /&gt;
 | year = 1956&lt;br /&gt;
 | doi = 10.1109/TIT.1956.1056813&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;Chomsky1957&amp;quot;&amp;gt;{{Cite book&lt;br /&gt;
 | author = Chomsky, Noam&lt;br /&gt;
 | title = Syntactic Structures&lt;br /&gt;
 | publisher = [[Mouton]]&lt;br /&gt;
 | location = The Hague&lt;br /&gt;
 | year = 1957&lt;br /&gt;
}}&amp;lt;/ref&amp;gt; a grammar &amp;#039;&amp;#039;G&amp;#039;&amp;#039; consists of the following components:&lt;br /&gt;
* A finite set &amp;#039;&amp;#039;N&amp;#039;&amp;#039; of &amp;#039;&amp;#039;[[nonterminal symbol]]s&amp;#039;&amp;#039;, that is [[Disjoint sets|disjoint]] with the strings formed from &amp;#039;&amp;#039;G&amp;#039;&amp;#039;.&lt;br /&gt;
* A finite set &amp;lt;math&amp;gt;\Sigma&amp;lt;/math&amp;gt; of &amp;#039;&amp;#039;[[terminal symbol]]s&amp;#039;&amp;#039; that is [[Disjoint sets|disjoint]] from &amp;#039;&amp;#039;N&amp;#039;&amp;#039;.&lt;br /&gt;
* A finite set &amp;#039;&amp;#039;P&amp;#039;&amp;#039; of &amp;#039;&amp;#039;production rules&amp;#039;&amp;#039;, each rule of the form&lt;br /&gt;
:: &amp;lt;math&amp;gt;(\Sigma \cup N)^{*} N (\Sigma \cup N)^{*} \rightarrow (\Sigma \cup N)^{*} &amp;lt;/math&amp;gt; &lt;br /&gt;
:where &amp;lt;math&amp;gt;{*}&amp;lt;/math&amp;gt; is the [[Kleene star]] operator and &amp;lt;math&amp;gt;\cup&amp;lt;/math&amp;gt; denotes [[union (set theory)|set union]]. That is, each production rule maps from one string of symbols to another, where the first string (the &amp;quot;head&amp;quot;) contains an arbitrary number of symbols provided at least one of them is a nonterminal. In the case that the second string (the &amp;quot;body&amp;quot;) consists solely of the [[empty string]] &amp;amp;ndash; i.e., that it contains no symbols at all &amp;amp;ndash; it may be denoted with a special notation (often &amp;lt;math&amp;gt;\Lambda&amp;lt;/math&amp;gt;, &amp;#039;&amp;#039;e&amp;#039;&amp;#039; or &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;) in order to avoid confusion.&lt;br /&gt;
* A distinguished symbol &amp;lt;math&amp;gt;S \in N&amp;lt;/math&amp;gt; that is the &amp;#039;&amp;#039;start symbol&amp;#039;&amp;#039;, also called the &amp;#039;&amp;#039;sentence symbol&amp;#039;&amp;#039;.&lt;br /&gt;
A grammar is formally defined as the [[tuple]] &amp;lt;math&amp;gt;(N, \Sigma, P, S)&amp;lt;/math&amp;gt;. Such a formal grammar is often called a [[rewriting system]] or a [[phrase structure grammar]] in the literature.&amp;lt;ref&amp;gt;{{cite book|first=Seymour|last=Ginsburg|authorlink=Seymour Ginsburg|title=Algebraic and automata theoretic properties of formal languages|publisher=North-Holland|pages=8–9|year=1975|isbn=0-7204-2506-9}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite book|last=Harrison|first=Michael A.|authorlink=Michael A. Harrison|title=Introduction to Formal Language Theory|year=1978|pages=13|isbn=0-201-02955-3|location=Reading, Mass.|publisher=Addison-Wesley Publishing Company}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The semantics of grammars ===&lt;br /&gt;
&lt;br /&gt;
The operation of a grammar can be defined in terms of relations on strings:&lt;br /&gt;
* Given a grammar &amp;lt;math&amp;gt;G = (N, \Sigma, P, S)&amp;lt;/math&amp;gt;, the binary relation &amp;lt;math&amp;gt;\Rightarrow_G&amp;lt;/math&amp;gt; (pronounced as  &amp;quot;G derives in one step&amp;quot;) on strings in &amp;lt;math&amp;gt;(\Sigma \cup N)^{*}&amp;lt;/math&amp;gt; is defined by:&lt;br /&gt;
&amp;lt;math&amp;gt;x \Rightarrow_G y \mbox{ iff } \exists u, v, p, q \in (\Sigma \cup N)^*: (x = upv) \wedge (p \rightarrow q \in P) \wedge (y = uqv)&amp;lt;/math&amp;gt;&lt;br /&gt;
* the relation &amp;lt;math&amp;gt;{\Rightarrow_G}^*&amp;lt;/math&amp;gt; (pronounced as &amp;#039;&amp;#039;G derives in zero or more steps&amp;#039;&amp;#039;) is defined as the [[reflexive transitive closure]] of &amp;lt;math&amp;gt;\Rightarrow_G&amp;lt;/math&amp;gt;&lt;br /&gt;
* a {{anchor|sentential-form}}&amp;#039;&amp;#039;sentential form&amp;#039;&amp;#039; is a member of &amp;lt;math&amp;gt;(\Sigma \cup N)^*&amp;lt;/math&amp;gt; that can be derived in a finite number of steps from the start symbol &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;; that is, a sentential form is a member of &amp;lt;math&amp;gt;\{ w \in (\Sigma \cup N)^* \mid S {\Rightarrow_G}^* w \}&amp;lt;/math&amp;gt;. A sentential form that contains no nonterminal symbols (i.e. is a member of &amp;lt;math&amp;gt;\Sigma^*&amp;lt;/math&amp;gt;) is called a &amp;#039;&amp;#039;sentence&amp;#039;&amp;#039;.&amp;lt;ref&amp;gt;[http://www.seas.upenn.edu/~cit596/notes/dave/cfg7.html Sentential Forms], Context-Free Grammars, David Matuszek&amp;lt;/ref&amp;gt;&lt;br /&gt;
* the &amp;#039;&amp;#039;language&amp;#039;&amp;#039; of &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;, denoted as &amp;lt;math&amp;gt;\boldsymbol{L}(G)&amp;lt;/math&amp;gt;, is defined as all those sentences that can be derived in a finite number of steps from the start symbol &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;; that is, the set &amp;lt;math&amp;gt;\{ w \in \Sigma^* \mid S {\Rightarrow_G}^* w \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that the grammar &amp;lt;math&amp;gt;G = (N, \Sigma, P, S)&amp;lt;/math&amp;gt; is effectively the [[semi-Thue system]] &amp;lt;math&amp;gt;(N \cup \Sigma, P)&amp;lt;/math&amp;gt;, rewriting strings in exactly the same way; the only difference is in that we distinguish specific &amp;#039;&amp;#039;nonterminal&amp;#039;&amp;#039; symbols which must be rewritten in rewrite rules, and are only interested in rewritings from the designated start symbol &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; to strings without nonterminal symbols.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;#039;&amp;#039;For these examples, formal languages are specified using [[set-builder notation]].&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Consider the grammar &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;N = \left \{S, B\right \}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Sigma = \left \{a, b, c\right \}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; is the start symbol, and &amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt; consists of the following production rules:&lt;br /&gt;
&lt;br /&gt;
: 1. &amp;lt;math&amp;gt;S \rightarrow aBSc&amp;lt;/math&amp;gt;&lt;br /&gt;
: 2. &amp;lt;math&amp;gt;S \rightarrow abc&amp;lt;/math&amp;gt;&lt;br /&gt;
: 3. &amp;lt;math&amp;gt;Ba \rightarrow aB&amp;lt;/math&amp;gt;&lt;br /&gt;
: 4. &amp;lt;math&amp;gt;Bb \rightarrow bb &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This grammar defines the language &amp;lt;math&amp;gt;L(G) = \left \{ a^{n}b^{n}c^{n} | n \ge 1 \right \}&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a^{n}&amp;lt;/math&amp;gt; denotes a string of &amp;#039;&amp;#039;n&amp;#039;&amp;#039; consecutive &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;&amp;#039;s. Thus, the language is the set of strings that consist of 1 or more &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;&amp;#039;s, followed by the same number of &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt;&amp;#039;s, followed by the same number of &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Some examples of the derivation of strings in &amp;lt;math&amp;gt;L(G)&amp;lt;/math&amp;gt; are: &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\boldsymbol{S} \Rightarrow_2 \boldsymbol{abc}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\boldsymbol{S} \Rightarrow_1 \boldsymbol{aBSc} \Rightarrow_2 aB\boldsymbol{abc}c \Rightarrow_3 a\boldsymbol{aB}bcc \Rightarrow_4 aa\boldsymbol{bb}cc&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\boldsymbol{S} \Rightarrow_1 \boldsymbol{aBSc} \Rightarrow_1 aB\boldsymbol{aBSc}c \Rightarrow_2 aBaB\boldsymbol{abc}cc \Rightarrow_3 a\boldsymbol{aB}Babccc \Rightarrow_3 aaB\boldsymbol{aB}bccc &amp;lt;/math&amp;gt;&amp;lt;math&amp;gt; \Rightarrow_3 aa\boldsymbol{aB}Bbccc \Rightarrow_4 aaaB\boldsymbol{bb}ccc \Rightarrow_4 aaa\boldsymbol{bb}bccc&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:(Note on notation: &amp;lt;math&amp;gt;P \Rightarrow_i Q&amp;lt;/math&amp;gt; reads &amp;quot;String &amp;#039;&amp;#039;P&amp;#039;&amp;#039; generates string &amp;#039;&amp;#039;Q&amp;#039;&amp;#039; by means of production &amp;#039;&amp;#039;i&amp;#039;&amp;#039;&amp;quot;, and the generated part is each time indicated in bold type.)&lt;br /&gt;
&lt;br /&gt;
== The Chomsky hierarchy ==&lt;br /&gt;
{{main|Chomsky hierarchy}} &amp;lt;!-- for me THIS article is BETTER, but for wiki structure the whole article is bigger than a section --&amp;gt;&lt;br /&gt;
When [[Noam Chomsky]] first formalized generative grammars in 1956,&amp;lt;ref name=&amp;quot;Chomsky1956&amp;quot;/&amp;gt; he classified them into types now known as the [[Chomsky hierarchy]].  The difference between these types is that they have increasingly strict production rules and can express fewer formal languages. Two important types are &amp;#039;&amp;#039;[[context-free grammar]]s&amp;#039;&amp;#039; (Type 2) and &amp;#039;&amp;#039;[[regular grammar]]s&amp;#039;&amp;#039; (Type 3). The languages that can be described with such a grammar are called &amp;#039;&amp;#039;[[context-free language]]s&amp;#039;&amp;#039; and &amp;#039;&amp;#039;[[regular language]]s&amp;#039;&amp;#039;, respectively. Although much less powerful than [[unrestricted grammar]]s (Type 0), which can in fact express any language that can be accepted by a [[Turing machine]], these two restricted types of grammars are most often used because [[parsing|parser]]s for them can be efficiently implemented.&amp;lt;ref name=&amp;quot;Grune&amp;amp;Jacobs1990&amp;quot;&amp;gt;Grune, Dick &amp;amp; Jacobs, Ceriel H., &amp;#039;&amp;#039;Parsing Techniques &amp;amp;ndash; A Practical Guide&amp;#039;&amp;#039;, Ellis Horwood, England, 1990.&amp;lt;/ref&amp;gt; For example, all regular languages can be recognized by a [[finite state machine]], and for useful subsets of context-free grammars there are well-known algorithms to generate efficient [[LL parser]]s and [[LR parser]]s to recognize the corresponding languages those grammars generate.&lt;br /&gt;
&lt;br /&gt;
=== Context-free grammars ===&lt;br /&gt;
A &amp;#039;&amp;#039;[[context-free grammar]]&amp;#039;&amp;#039; is a grammar in which the left-hand side of each production rule consists of only a single nonterminal symbol. This restriction is non-trivial; not all languages can be generated by context-free grammars. Those that can are called &amp;#039;&amp;#039;context-free languages&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
The language &amp;lt;math&amp;gt;L(G) = \left \{ a^{n}b^{n}c^{n} | n \ge 1 \right \}&amp;lt;/math&amp;gt; defined above is not a context-free language, and this can be strictly proven using the [[pumping lemma for context-free languages]], but for example the language &amp;lt;math&amp;gt;\left \{ a^{n}b^{n} | n \ge 1 \right \}&amp;lt;/math&amp;gt; (at least 1 &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; followed by the same number of &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt;&amp;#039;s) is context-free, as it can be defined by the grammar &amp;lt;math&amp;gt;G_2&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;N=\left \{S\right \}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Sigma=\left \{a,b\right \}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; the start symbol, and the following production rules:&lt;br /&gt;
&lt;br /&gt;
: 1. &amp;lt;math&amp;gt;S \rightarrow aSb&amp;lt;/math&amp;gt;&lt;br /&gt;
: 2. &amp;lt;math&amp;gt;S \rightarrow ab&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A context-free language can be recognized in &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; time (&amp;#039;&amp;#039;see&amp;#039;&amp;#039; [[Big O notation]]) by an algorithm such as [[Earley&amp;#039;s algorithm]]. That is, for every context-free language, a machine can be built that takes a string as input and determines in &amp;lt;math&amp;gt;O(n^3)&amp;lt;/math&amp;gt; time whether the string is a member of the language, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the length of the string.&amp;lt;ref name=&amp;quot;Earley1970&amp;quot;&amp;gt;Earley, Jay, &amp;quot;An Efficient Context-Free Parsing Algorithm,&amp;quot; &amp;#039;&amp;#039;Communications of the ACM&amp;#039;&amp;#039;, Vol. 13 No. 2, pp. 94-102, February 1970.&amp;lt;/ref&amp;gt; [[Deterministic context-free language]]s is a subset of context-free languages that can be recognized in linear time.&amp;lt;ref&amp;gt;{{cite doi|10.1016/S0019-9958(65)90426-2}}&amp;lt;/ref&amp;gt; There exist various algorithms that target either this set of languages or some subset of it.&lt;br /&gt;
&lt;br /&gt;
=== Regular grammars ===&lt;br /&gt;
In [[regular grammar]]s, the left hand side is again only a single nonterminal symbol, but now the right-hand side is also restricted. The right side may be the empty string, or a single terminal symbol, or a single terminal symbol followed by a nonterminal symbol, but nothing else. (Sometimes a broader definition is used: one can allow longer strings of terminals or single nonterminals without anything else, making languages [[syntactic sugar|easier to denote]] while still defining the same class of languages.)&lt;br /&gt;
&lt;br /&gt;
The language &amp;lt;math&amp;gt;\left \{ a^{n}b^{n} | n \ge 1 \right \}&amp;lt;/math&amp;gt; defined above is not regular, but the language &amp;lt;math&amp;gt;\left \{ a^{n}b^{m} \,| \, m,n \ge 1 \right \}&amp;lt;/math&amp;gt; (at least 1 &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; followed by at least 1 &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt;, where the numbers may be different) is, as it can be defined by the grammar &amp;lt;math&amp;gt;G_3&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;N=\left \{S, A,B\right \}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Sigma=\left \{a,b\right \}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; the start symbol, and the following production rules:&lt;br /&gt;
&lt;br /&gt;
:# &amp;lt;math&amp;gt;S \rightarrow aA&amp;lt;/math&amp;gt;&lt;br /&gt;
:# &amp;lt;math&amp;gt;A \rightarrow aA&amp;lt;/math&amp;gt;&lt;br /&gt;
:# &amp;lt;math&amp;gt;A \rightarrow bB&amp;lt;/math&amp;gt;&lt;br /&gt;
:# &amp;lt;math&amp;gt;B \rightarrow bB&amp;lt;/math&amp;gt;&lt;br /&gt;
:# &amp;lt;math&amp;gt;B \rightarrow \epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All languages generated by a regular grammar can be recognized in linear time by a [[finite state machine]]. Although, in practice, regular grammars are commonly expressed using [[regular expression]]s, some forms of regular expression used in practice do not strictly generate the regular languages and do not show linear recognitional performance due to those deviations.&lt;br /&gt;
&lt;br /&gt;
=== Other forms of generative grammars ===&lt;br /&gt;
Many extensions and variations on Chomsky&amp;#039;s original hierarchy of formal grammars have been developed, both by linguists and by computer scientists, usually either in order to increase their expressive power or in order to make them easier to analyze or [[parsing|parse]]. Some forms of grammars developed include:&lt;br /&gt;
&lt;br /&gt;
* [[Tree-adjoining grammar]]s increase the expressiveness of conventional generative grammars by allowing rewrite rules to operate on [[parse tree]]s instead of just strings.&amp;lt;ref name=&amp;quot;JoshiEtAl1975&amp;quot;&amp;gt;Joshi, Aravind K., &amp;#039;&amp;#039;et al.&amp;#039;&amp;#039;, &amp;quot;Tree Adjunct Grammars,&amp;quot; &amp;#039;&amp;#039;Journal of Computer Systems Science&amp;#039;&amp;#039;, Vol. 10 No. 1, pp. 136-163, 1975.&amp;lt;/ref&amp;gt;&lt;br /&gt;
* [[Affix grammar]]s&amp;lt;ref name=&amp;quot;Koster1971&amp;quot;&amp;gt;Koster , Cornelis H. A., &amp;quot;Affix Grammars,&amp;quot; in &amp;#039;&amp;#039;ALGOL 68 Implementation&amp;#039;&amp;#039;, North Holland Publishing Company, Amsterdam, p. 95-109, 1971.&amp;lt;/ref&amp;gt; and [[attribute grammar]]s&amp;lt;ref name=&amp;quot;Knuth1968&amp;quot;&amp;gt;Knuth, Donald E., &amp;quot;Semantics of Context-Free Languages,&amp;quot; &amp;#039;&amp;#039;Mathematical Systems Theory&amp;#039;&amp;#039;, Vol. 2 No. 2, pp. 127-145, 1968.&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;Knuth1971&amp;quot;&amp;gt;Knuth, Donald E., &amp;quot;Semantics of Context-Free Languages (correction),&amp;quot; &amp;#039;&amp;#039;Mathematical Systems Theory&amp;#039;&amp;#039;, Vol. 5 No. 1, pp 95-96, 1971.&amp;lt;/ref&amp;gt; allow rewrite rules to be augmented with semantic attributes and operations, useful both for increasing grammar expressiveness and for constructing practical language translation tools.&lt;br /&gt;
&lt;br /&gt;
=== Recursive grammars ===&lt;br /&gt;
{{distinguish|Recursive language}}&lt;br /&gt;
A recursive grammar is a grammar which contains production rules that are [[recursion (computer science)|recursive]]. For example, a  grammar for a [[context-free language]] is [[left recursion|left-recursive]] if there exists a non-terminal symbol &amp;#039;&amp;#039;A&amp;#039;&amp;#039; that can be put through the production rules to produce a string with &amp;#039;&amp;#039;A&amp;#039;&amp;#039; as the leftmost symbol.&amp;lt;ref&amp;gt;[http://www.cs.may.ie/~jpower/Courses/parsing/parsing.pdf#search=&amp;#039;indirect%20left%20recursion&amp;#039;  Notes on Formal Language Theory and Parsing], James Power, Department of Computer Science National University of Ireland, Maynooth Maynooth, Co. Kildare, Ireland.[[JPR02]]&amp;lt;/ref&amp;gt;&lt;br /&gt;
All types of grammars in the [[Chomsky hierarchy]] can be recursive.&lt;br /&gt;
&lt;br /&gt;
== Analytic grammars ==&lt;br /&gt;
Though there is a tremendous body of literature on [[parsing]] [[algorithms]], most of these algorithms assume that the language to be parsed is initially &amp;#039;&amp;#039;described&amp;#039;&amp;#039; by means of a &amp;#039;&amp;#039;generative&amp;#039;&amp;#039; formal grammar, and that the goal is to transform this generative grammar into a working parser. Strictly speaking, a generative grammar does not in any way correspond to the algorithm used to parse a language, and various algorithms have different restrictions on the form of production rules that are considered well-formed.&lt;br /&gt;
&lt;br /&gt;
An alternative approach is to formalize the language in terms of an analytic grammar in the first place, which more directly corresponds to the structure and semantics of a parser for the language. Examples of analytic grammar formalisms include the following:&lt;br /&gt;
* [http://languagemachine.sourceforge.net/ The Language Machine] directly implements unrestricted analytic grammars. Substitution rules are used to transform an input to produce outputs and behaviour. The system can also produce [http://languagemachine.sourceforge.net/picturebook.html the lm-diagram] which shows what happens when the rules of an unrestricted analytic grammar are being applied.&lt;br /&gt;
* [[Top-down parsing language]] (TDPL): a highly minimalist analytic grammar formalism developed in the early 1970s to study the behavior of [[Top-down parsing|top-down parsers]].&amp;lt;ref name=&amp;quot;Birman1970&amp;quot;&amp;gt;Birman, Alexander, &amp;#039;&amp;#039;The TMG Recognition Schema&amp;#039;&amp;#039;, Doctoral thesis, Princeton University, Dept. of Electrical Engineering, February 1970.&amp;lt;/ref&amp;gt;&lt;br /&gt;
* [[Link grammar]]s: a form of analytic grammar designed for [[linguistics]], which derives syntactic structure by examining the positional relationships between pairs of words.&amp;lt;ref name=&amp;quot;Sleater&amp;amp;Temperly1991&amp;quot;&amp;gt;Sleator, Daniel D. &amp;amp; Temperly, Davy, &amp;quot;Parsing English with a Link Grammar,&amp;quot; Technical Report CMU-CS-91-196, Carnegie Mellon University Computer Science, 1991.&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;Sleater&amp;amp;Temperly1993&amp;quot;&amp;gt;Sleator, Daniel D. &amp;amp; Temperly, Davy, &amp;quot;Parsing English with a Link Grammar,&amp;quot; &amp;#039;&amp;#039;Third International Workshop on Parsing Technologies&amp;#039;&amp;#039;, 1993. (Revised version of above report.)&amp;lt;/ref&amp;gt;&lt;br /&gt;
* [[Parsing expression grammar]]s (PEGs): a more recent generalization of TDPL designed around the practical [[Expressivity_(computer_science)|expressiveness]] needs of [[programming language]] and [[compiler]] writers.&amp;lt;ref&amp;gt;Ford, Bryan, &amp;#039;&amp;#039;Packrat Parsing: a Practical Linear-Time Algorithm with Backtracking&amp;#039;&amp;#039;, Master’s thesis, Massachusetts Institute of Technology, Sept. 2002.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&amp;lt;div style=&amp;quot;-moz-column-count:3; column-count:3;&amp;quot;&amp;gt;&lt;br /&gt;
* [[Abstract syntax tree]]&lt;br /&gt;
* [[Adaptive grammar]]&lt;br /&gt;
* [[Ambiguous grammar]]&lt;br /&gt;
* [[Backus–Naur form|Backus–Naur form (BNF)]]&lt;br /&gt;
* [[Categorial grammar]]&lt;br /&gt;
* [[Concrete syntax tree]]&lt;br /&gt;
* [[Extended Backus–Naur form|Extended Backus–Naur form (EBNF)]]&lt;br /&gt;
* [[Grammar framework]]&lt;br /&gt;
* [[L-system]]&lt;br /&gt;
* [[Lojban]]&lt;br /&gt;
* [[Post canonical system]]&lt;br /&gt;
* [[Shape grammar]]&lt;br /&gt;
* [[Well-formed formula]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://cs.haifa.ac.il/~shuly/fg/ Yearly Formal Grammar conference]&lt;br /&gt;
&lt;br /&gt;
{{Formal languages and grammars}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Formal languages]]&lt;br /&gt;
[[Category:Grammar]]&lt;br /&gt;
[[Category:Linguistics]]&lt;br /&gt;
[[Category:Mathematical logic]]&lt;br /&gt;
[[Category:Syntax]]&lt;br /&gt;
[[Category:Automata theory]]&lt;/div&gt;</summary>
		<author><name>en&gt;Patrick87</name></author>
	</entry>
</feed>