|
|
Line 1: |
Line 1: |
| A '''two-level grammar''' is a [[formal grammar]] that is used to generate another formal grammar [http://web.cs.wpi.edu/~jshutt/adapt/2level.html], such as one with an infinite rule set [http://www.metanotion.net/misc/thesis.pdf#search=%22van%20Wijngaarden%20grammar%20Algol68%20ACM%20Portal%22]. This is how a [[Van Wijngaarden grammar]] was used to specify Algol68 [http://burks.bton.ac.uk/burks/language/other/a68rr/rrtoc.htm]. A [[context free grammar]] that defines the rules for a second grammar can yield an effectively infinite set of rules for the derived grammar. This makes such two-level grammars more powerful than a single layer of context free grammar, because generative two-level grammars have actually been shown to be [[Turing complete]].<ref>Sintzoff, M. "Existence of van Wijngaarden syntax for every recursively enumerable set", Annales de la Société Scientifique de Bruxelles 2 (1967), 115-118.</ref>
| |
|
| |
|
| ''Two-level grammar'' can also refer to a formal grammar for a two-level [[formal language]], which is a formal language specified at two levels, for example, the levels of words and sentences.{{Citation needed|date=February 2007}}
| |
|
| |
|
| ==Example==
| | Greetings. The author's name is Eusebio although he never really beloved that name. In his professional life he is a people manager. He's always [http://data.gov.uk/data/search?q=loved+living loved living] in Guam and he features everything that he has to have there. To drive is one of a person's things he loves most. He's been working by his website for individuals time now. Check that will out here: http://prometeu.net<br><br>Feel free to surf to my blog post; [http://prometeu.net clash of clans hack no survey no password] |
| A well-known non-context-free language is
| |
| :<math>\{a^n b^n a^n | n \ge 1\}.</math>
| |
| A two-level grammar for this language is the metagrammar
| |
| :N ::= 1 | N1
| |
| :X ::= a | b
| |
| together with grammar schema
| |
| :Start ::= <math> \langle a^N \rangle\langle b^N \rangle\langle a^N \rangle </math>
| |
| :<math> \langle X^{N1} \rangle</math> ::= <math>\langle X^N \rangle X </math>
| |
| :<math> \langle X^1 \rangle</math> ::= X
| |
| | |
| ==See also== | |
| *[[Affix grammar]]
| |
| *[[Attribute grammar]]
| |
| *[[Van Wijngaarden grammar]]
| |
| | |
| ==References==
| |
| <references/>
| |
| | |
| ==External links==
| |
| * Petersson, Kent (1990), "Syntax and Semantics of Programming Languages", Draft Lecture Notes, [http://www.cs.chalmers.se/~kentp/proglang.pdf PDF text].
| |
| | |
| {{DEFAULTSORT:Two-Level Grammar}}
| |
| [[Category:Formal languages]]
| |
| | |
| | |
| {{compu-lang-stub}}
| |
Revision as of 08:20, 3 March 2014
Greetings. The author's name is Eusebio although he never really beloved that name. In his professional life he is a people manager. He's always loved living in Guam and he features everything that he has to have there. To drive is one of a person's things he loves most. He's been working by his website for individuals time now. Check that will out here: http://prometeu.net
Feel free to surf to my blog post; clash of clans hack no survey no password