Generalized context-free grammar: Difference between revisions
←Created page with 'Generalized Context-free Grammar (GCFG) is a grammar formalism that expands on context-free grammars by adding potentially non-context free composition functions to...' |
Mouhaned99 (talk | contribs) No edit summary |
||
Line 56: | Line 56: | ||
A grammar in which all composition functions are both linear and regular is called a Linear Context-free Rewriting System (LCFRS), a subset of the GCFGs with strictly less computational power than the GCFGs as a whole, which is weakly equivalent to multicomponent [[Tree adjoining grammar]]s. [[Head grammar]] is an example of an LCFRS that is strictly less powerful than the class of LCFRSs as a whole. |
A grammar in which all composition functions are both linear and regular is called a Linear Context-free Rewriting System (LCFRS), a subset of the GCFGs with strictly less computational power than the GCFGs as a whole, which is weakly equivalent to multicomponent [[Tree adjoining grammar]]s. [[Head grammar]] is an example of an LCFRS that is strictly less powerful than the class of LCFRSs as a whole. |
||
==Converting a context-free grammar to Greibach Normal Form and Chomsky normal form using CNF/GNF software== |
|||
[[Cnf/gnf|CNF / GNF]] : is a software make the automatic Convertion of a context-free grammar to: |
|||
[[cnf/gnf|1- Chomsky normal form grammar (CNF).]] |
|||
[[cnf/gnf|2- Greibach normal form grammar (GNF).]] |
|||
and also it show you the new grammar in each of the steps of the transformation. |
|||
[[cnf/gnf|A- Chomsky normal normal grammar (CNF)]] |
|||
1- reduced grammar. |
|||
2- epsilon-free grammar. |
|||
3- grammar without cycles and unit rules . |
|||
4-CNF. |
|||
[[cnf/gnf|B-Greibach normal form grammar (GNF).]] |
|||
1- reduced grammar. |
|||
2- epsilon-free grammar. |
|||
3- without cycles and unit rules. |
|||
4- non-left recursive grammar. |
|||
5- GNF. |
|||
with this application you can have CNF and GNF for any context-free grammar just in few steps. |
|||
just run the application and create new project and enter your grammar and click done and you will have : |
|||
CNF and GNF grammar and the new grammar in each of the steps of the transformation. |
|||
== See also == |
|||
* [[Cnf/gnf|CNF/GNF]] |
|||
* [[Cnf/gnf|Chomsky normal form software]] |
|||
*[http://www.adfaria.com/ CNF/GNF Homepage] |
|||
*[http://www.adfaria.com/index.php?option=com_content&view=article&id=48&Itemid=29 CNF/GNF download] |
|||
==References== |
==References== |
Revision as of 06:40, 30 September 2010
Generalized Context-free Grammar (GCFG) is a grammar formalism that expands on context-free grammars by adding potentially non-context free composition functions to rewrite rules[1]. Head grammar (and its weak equivalents) is an instance of such a GCFG which is known to be especially adept at handling a wide variety of non-CF properties of natural language.
Description
A GCFG consists of two components: a set of composition functions that combine string tuples, and a set of rewrite rules. The composition functions all have the form , where is either a single string tuple, or some use of a (potentially different) composition function which reduces to a string tuple. Rewrite rules look like , where , , ... are string tuples or non-terminal symbols.
The rewrite semantics of GCFGs is fairly straight forward. An occurrence of a non-terminal symbol is rewritten using rewrite rules as in a context-free grammar, eventually yielding just compositions (composition functions applied to string tuples or other compositions). The composition functions are then applied, reducing successively reducing the tuples to a single tuple.
Example
A simple translation of a context-free grammar into a GCFG can be performed in the following fashion. Given the grammar in (1), which generates the palindrome language , where is the string reverse of , we can define the composition function conc as in (2a) and the rewrite rules as in (2b).
The CF production of abbbba is
S
aSa
abSba
abbSbba
abbbba
and the corresponding GCFG production is
Linear Context-free Rewriting Systems (LCFRSs)
Weir (1988)[1] describes two properties of composition functions, linearity and regularity. A function defined as is linear if and only if each variable appears at most once on either side of the =, making liner but not . A function defined as is regular if the left hand side and right hand side have the exact same variables, making regular but not or .
A grammar in which all composition functions are both linear and regular is called a Linear Context-free Rewriting System (LCFRS), a subset of the GCFGs with strictly less computational power than the GCFGs as a whole, which is weakly equivalent to multicomponent Tree adjoining grammars. Head grammar is an example of an LCFRS that is strictly less powerful than the class of LCFRSs as a whole.
Converting a context-free grammar to Greibach Normal Form and Chomsky normal form using CNF/GNF software
CNF / GNF : is a software make the automatic Convertion of a context-free grammar to:
1- Chomsky normal form grammar (CNF).
2- Greibach normal form grammar (GNF).
and also it show you the new grammar in each of the steps of the transformation.
A- Chomsky normal normal grammar (CNF)
1- reduced grammar.
2- epsilon-free grammar.
3- grammar without cycles and unit rules .
4-CNF.
B-Greibach normal form grammar (GNF).
1- reduced grammar.
2- epsilon-free grammar.
3- without cycles and unit rules.
4- non-left recursive grammar.
5- GNF.
with this application you can have CNF and GNF for any context-free grammar just in few steps.
just run the application and create new project and enter your grammar and click done and you will have :
CNF and GNF grammar and the new grammar in each of the steps of the transformation.