Two-level grammar

A two-level grammar is a formal grammar that is used to generate another formal grammar , such as one with an infinite rule set . This is how a Van Wijngaarden grammar was used to specify Algol 68 . 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.[1]

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.

Example

A well-known non-context-free language is

A two-level grammar for this language is the metagrammar

N ::= 1 | N1
X ::= a | b

together with grammar schema

Start ::=
::=
::= X
gollark: I just get a "404 not found" page but I suspect it's some sort of weird local ipv6 address.
gollark: I need to test this. Please visit the following URL and tell me what it says: http://[fdaa:bbcc:ddee:0:a2b3:ccff:feea:e38b]/
gollark: Anyway, skynet *can* "send files and receive" if you write code to do so.
gollark: I don't currently have one. If there's demand I'll make Chorus City Storage Units.
gollark: No, it's a special new test version.

See also

References

  1. Sintzoff, M. "Existence of van Wijngaarden syntax for every recursively enumerable set", Annales de la Société Scientifique de Bruxelles 2 (1967), 115-118.
  • Petersson, Kent (1990), "Syntax and Semantics of Programming Languages", Draft Lecture Notes, PDF text.


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.