<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.karljones.com/index.php?action=history&amp;feed=atom&amp;title=Context-free_grammar</id>
		<title>Context-free grammar - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.karljones.com/index.php?action=history&amp;feed=atom&amp;title=Context-free_grammar"/>
		<link rel="alternate" type="text/html" href="http://wiki.karljones.com/index.php?title=Context-free_grammar&amp;action=history"/>
		<updated>2026-10-23T21:42:33Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>http://wiki.karljones.com/index.php?title=Context-free_grammar&amp;diff=14928&amp;oldid=prev</id>
		<title>Karl Jones: Created page with &quot;In formal language theory, a '''context-free grammar''' ('''CFG''') is a formal grammar.  == Description ==  A context-free grammar is a formal grammar in which ev...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.karljones.com/index.php?title=Context-free_grammar&amp;diff=14928&amp;oldid=prev"/>
				<updated>2016-05-09T14:49:09Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;In &lt;a href=&quot;/index.php/Formal_language&quot; title=&quot;Formal language&quot;&gt;formal language&lt;/a&gt; theory, a &amp;#039;&amp;#039;&amp;#039;context-free grammar&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;CFG&amp;#039;&amp;#039;&amp;#039;) is a &lt;a href=&quot;/index.php/Formal_grammar&quot; title=&quot;Formal grammar&quot;&gt;formal grammar&lt;/a&gt;.  == Description ==  A context-free grammar is a &lt;a href=&quot;/index.php/Formal_grammar&quot; title=&quot;Formal grammar&quot;&gt;formal grammar&lt;/a&gt; in which ev...&amp;quot;&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 '''context-free grammar''' ('''CFG''') is a [[formal grammar]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
A context-free grammar is a [[formal grammar]] in which every production rule is of the form&lt;br /&gt;
&lt;br /&gt;
 A\ \to\ \alpha&lt;br /&gt;
&lt;br /&gt;
where A is a single nonterminal symbol, and \alpha is a string of terminals and/or nonterminals (\alpha can be empty).&lt;br /&gt;
&lt;br /&gt;
A formal grammar is considered &amp;quot;context free&amp;quot; when its production rules can be applied regardless of the context of a nonterminal.&lt;br /&gt;
&lt;br /&gt;
No matter which symbols surround it, the single nonterminal on the left hand side can always be replaced by the right hand side.&lt;br /&gt;
&lt;br /&gt;
This is what distinguishes it from a [[context-sensitive grammar]].&lt;br /&gt;
&lt;br /&gt;
Such a grammar has long lists of words, and also rules on what types of words can be added in what order.&lt;br /&gt;
&lt;br /&gt;
Higher rules combine several lower rules to make a sentence. Such sentences will be grammatically correct, but may not have any meaning.&lt;br /&gt;
&lt;br /&gt;
Each rule has its own symbol, which can be replaced with symbols representing lower rules, which can be replaced with words.&lt;br /&gt;
This can also be done in reverse to check if a sentence is grammatically correct.&lt;br /&gt;
&lt;br /&gt;
Languages generated by context-free grammars are known as context-free languages (CFL). Different context-free grammars can generate the same context-free language.&lt;br /&gt;
&lt;br /&gt;
It is important to distinguish properties of the language (intrinsic properties) from properties of a particular grammar (extrinsic properties).&lt;br /&gt;
&lt;br /&gt;
The language equality question (do two given context-free grammars generate the same language?) is undecidable.&lt;br /&gt;
&lt;br /&gt;
Context-free grammars arise in [[linguistics]] where they are used to describe the structure of sentences and words in natural language, and they were in fact invented by the linguist [[Noam Chomsky]] for this purpose, but have not really lived up to their original expectation.&lt;br /&gt;
&lt;br /&gt;
By contrast, in [[computer science]], as the use of [[recursively]] defined concepts increased, they were used more and more.&lt;br /&gt;
&lt;br /&gt;
In an early application, grammars are used to describe the structure of [[programming languages]].&lt;br /&gt;
&lt;br /&gt;
In a newer application, they are used in an essential part of the [[Extensible Markup Language]] (XML) called the [[Document Type Definition]].&lt;br /&gt;
&lt;br /&gt;
In [[linguistics]], some authors use the term phrase structure grammar to refer to context-free grammars, whereby phrase structure grammars are distinct from dependency grammars.&lt;br /&gt;
&lt;br /&gt;
In [[computer science]], a popular notation for context-free grammars is [[Backus–Naur Form]], or BNF.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Context-sensitive grammar]]&lt;br /&gt;
* [[Deterministic context-free grammar]]&lt;br /&gt;
* [[Deterministic parsing]]&lt;br /&gt;
* [[Formal language]]&lt;br /&gt;
* [[LL parser]]&lt;br /&gt;
&lt;br /&gt;
== External links == &lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Deterministic_context-free_grammar Context-free grammar] @ Wikiepedia&lt;br /&gt;
&lt;br /&gt;
[[Category:Computer science]]&lt;br /&gt;
[[Category:Computing]]&lt;br /&gt;
[[Category:Formal languages]]&lt;/div&gt;</summary>
		<author><name>Karl Jones</name></author>	</entry>

	</feed>