Talk:Two-level grammar
This redirect does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||
|
The contents of the Two-level grammar page were merged into Van Wijngaarden grammar on 14 June 2023 and it now redirects there. For the contribution history and old versions of the merged article please see its history. |
Notes & Queries
[edit]JA: The last I remember, a 2-level grammar was a grammar for a 2-level language, which is, naturally enough, a language that is specified at 2 levels, say, words and sentences. And so on for k-level languages and grammars. I haven't seen this term used for "meta-grammars", though I do remember some papers from the 80's, by Douglas Hofstadter and others, on a similar idea, but I think they called them "control grammars" or something like that. So it would help to have a lit ref for this usage. Jon Awbrey 13:44, 28 April 2006 (UTC)
- Following your example a grammar such as:
Sentence ::= Word Sentence Word ::= word1 | word2 | ... | word_N_
- would be a two-level grammar. This doesn't seem very rigorous. --MarSch 14:51, 28 April 2006 (UTC)
JA: No, that's not how it's specified. Will find some refs later. Pending literature refs for the other usage, I'll suggest using "2-phase grammar" or "2-level metagrammar" for that. Jon Awbrey 15:22, 28 April 2006 (UTC)
- Well, it's all over google, but most links are not really useful to include, since they are not really about two-level gramamrs, but doing incomprehensible stuff with them. At least I found the lecture notes :) . Also many references with respect to Van Wijngaarden grammars mention two-level grammar as a synonnym or as a more general notion. There are not so many hits for Van Wijngaarden grammar though, 3 orders less or so. --MarSch 15:48, 28 April 2006 (UTC)
- For definateness: http://www.cis.uab.edu/bryant/papers/lpar92.pdf
- What would be good is a copy of “Two-level Grammar as a Functional Programming Language” [1] --MarSch 16:22, 28 April 2006 (UTC)
Bogus first definition
[edit]I have never seen the term two-level grammar used for the superposition of two grammars, such as the C preprocessor and the underlying C++ language. Unless someone can provide a valid reference for this simplistic/degenerate definition of two-level grammars, then the first definition should be removed. Only the second definition is what most people refer to when discussing two-level grammars such as van Wijngaarden grammars and the seminal Algol68 usage of vW TLGs. If the degenerate definition is allowed to stand, then this article will need to invent the term "generative two-level grammar" to describe what the rest of computer science calls "two-level grammar" in the van Wijngaarden sense. —optikos 23:36, 27 August 2006 (UTC)
I just checked this article out, and in addition to be rather lacking, I agree that the first definition should be removed. Also, there should be a reference to an important textbook on the subject, by Cleaveland and Uzgalis. I may get around to this one day. --Lasse Hillerøe Petersen 21:31, 27 February 2007 (UTC)
I've deemphasized what used to be the first definition ("a formal grammar for a two-level formal language"). It still needs to be either supported with a citation, or removed. David-Sarah Hopwood (talk) 14:11, 6 February 2009 (UTC)
Example
[edit]I am completely lost as to how the example given is supposed to constitute a two-level grammar. The definition given bears no relation to the usual formulation given at formal grammar. I would appreciate it if someone could explain this more clearly. How can the first formal grammar generate a language of production rules? SamSim (talk) 20:39, 14 January 2010 (UTC)
The metagrammar rule for N produce what you could call "numbers". The metagrammar rule for X produces simply the "names" a and b. Together with the protogrammar (sorry, I'm a bit rusty on the van Wijngarden terms, so I will not use his "hypernotion", "metanotion" and "protonotion", before I have ascertained which is which) this yields an "infinite" (or "as large as necessary") grammar, with rules like:
a1: a a11: a1 a ...
b1: b b11: b1 b ...
Start: a1 b1 a1 Start: a11 b11 a11 Start: a111 b111 a111 ...
(Or using typical alternative shorthand: Start: a1 b1 a1| a11 b11 a11 | a111 b111 a111 | ...)
Maybe this explanation can go in the article; I'd like to clean it up a bit, but if I don't get around to it (I am easily distracted, alas), I hope someone else does. --Lasse Hillerøe Petersen (talk) 08:59, 11 August 2010 (UTC)
Proposed merger
[edit]This article hasn’t developed as a stand-alone discussion of the topic. I’m therefore proposing merging it into Van Wijngaarden grammar and replacing this page with a redirect. —Northernhenge (talk) 20:17, 4 January 2023 (UTC)