Van Wijngaarden grammar

Van Wijngaarden grammar

A Van Wijngaarden grammar (also vW-grammar or W-grammar) is a two-level grammar which provides a technique to define potentially infinite grammars in a finite number of rules. It was invented by Adriaan van Wijngaarden to define rigorously some syntactic restrictions which previously had to be formulated in natural language, despite their essentially syntactical content. One of these is the requirement of uniqueness of identifiers in program units and the unification of application and definition of these identifiers.

The technique was used and developed in the definition of the programming language ALGOL 68.

Overview

A W-grammar consists of a finite set of meta-rules, which are used to derive (possibly infinitely many) production rules from a finite set of hyper-rules. Meta-rules are restricted to those defined by a context-free grammar. Hyper-rules restrict the admissible contexts at the upper level. Essentially, the "consistent substitution" used in the derivation process is equivalent to unification, as in Prolog, as was noted by Alain Colmerauer.

ALGOL 68 examples

Prior to ALGOL 68 the language ALGOL 60 was formalised using the context-free Backus–Naur form. And so the appearance of new context-sensitive two-level grammar presented a challenge to some readers of the 1968 ALGOL 68 "Final Report". Subsequently the final report was revised by Wijngaarden and his colleagues and published as the 1973 ALGOL 68 "Revised Report".

ALGOL 68 as in the 1968 Final Report §2.1

a) program : open symbol, standard prelude, library prelude option, particular program, exit, library postlude option, standard postlude, close symbol. b) standard prelude : declaration prelude sequence. c) library prelude : declaration prelude sequence. d) particular program : label sequence option, strong CLOSED void clause. e) exit : go on symbol , letter e letter x letter i letter t, label symbol. f) library postlude : statement interlude. g) standard postlude : strong void clause train

ALGOL 68 as in the 1973 Revised Report §2.2.1, §10.1.1

program : strong void new closed clause

A) EXTERNAL :: standard ; library ; system ; particular. B) STOP :: label letter s letter t letter o letter p.

a) program text : STYLE begin token, new LAYER1 preludes, parallel token, new LAYER1 tasks PACK, STYLE end token. b) NEST1 preludes : NEST1 standard prelude with DECS1, NEST1 library prelude with DECSETY2, NEST1 system prelude with DECSETY3, where (NEST1) is (new EMPTY new DECS1 DECSETY2 DECSETY3). c) NEST1 EXTERNAL prelude with DECSETY1 : strong void NEST1 series with DECSETY1, go on token ; where (DECSETY1) is (EMPTY), EMPTY. d) NEST1 tasks : NEST1 system task list, and also token, NEST1 user task PACK list. e) NEST1 system task : strong void NEST1 unit. f) NEST1 user task : NEST2 particular prelude with DECS, NEST2 particular program PACK, go on token, NEST2 particular postlude, where (NEST2) is (NEST1 new DECS STOP). g) NEST2 particular program : NEST2 new LABSETY3 joined label definition of LABSETY3, strong void NEST2 new LABSETY3 ENCLOSED clause. h) NEST joined label definition of LABSETY : where (LABSETY) is (EMPTY), EMPTY ; where (LABSETY) is (LAB1 LABSETY1), NEST label definition of LAB1, NEST joined label definition of$ LABSETY1. i) NEST2 particular postlude : strong void NEST2 series with STOP.

Applications outside of ALGOL 68

It was noted that two-level grammars are Turing complete and therefore had the potential to be used beyond their original field of application.

Anthony Fisher tried to construct a parser for general W-grammars [http://www-users.cs.york.ac.uk/~fisher/software/yoyovwg/] .

Dick Grune created a C program that would generate all possible productions of a 2-level grammar [http://www.cs.vu.nl/~dick/utils.html] .

Use of the method has been proposed for the description of complex human actions in ergonomics.

External links

* [http://www.bookrags.com/sciences/computerscience/algol-68-wcs.html Use in Algol68]
* [http://www.cwi.nl/~steven/vw.html Tutorial introduction] by Steven Pemberton.


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Adriaan van Wijngaarden — (2 November 1916 – 7 February 1987) was an important mathematician and computer scientist who is considered by many to have been the founding father of informatica (computer science) in the Netherlands. Even though he was trained as an engineer,… …   Wikipedia

  • Two-level grammar — A two level grammar is either one of two formal structures: # 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.Fact|date=February 2007 # A formal… …   Wikipedia

  • Affix grammar — An affix grammar is a kind of formal grammar; it is used to describe the syntax of languages, mainly computer languages, using an approach based on how natural language is typically described.The grammatical rules of an affix grammar are those of …   Wikipedia

  • Extended Affix Grammar — (EAG) is a formalism developed by Marc Seutter for describing both the context free syntax and the context sensitive syntax of programming languages.EAG is a member of the family of two level grammars. They are very closely related to two level… …   Wikipedia

  • Context-free grammar — In formal language theory, a context free grammar (CFG) is a formal grammar in which every production rule is of the form V → w where V is a single nonterminal symbol, and w is a string of terminals and/or nonterminals (w can be empty). The… …   Wikipedia

  • Delft University of Technology — Technische Universiteit Delft Motto Challenge the Future …   Wikipedia

  • History of programming languages — This article discusses the major developments in the history of programming languages. For a detailed timeline of events, see the timeline of programming languages. History of Programming Languages The first programming languages predate the… …   Wikipedia

  • Ван Вейнгаарден, Адриан — Адриан ван Вейнгаарден Adriaan van Wijngaarden Дата рождения: 2 ноября 1916(1916 11 02) Место рождения: Роттердам Дата смерти …   Википедия

  • ALGOL — This article is about the programming language family. For other uses, see Algol (disambiguation). ALGOL Paradigm(s) procedural, imperative, structured Appeared in 1958 Designed by Bauer, Bottenbruch, Rutishauser, Samelson, Backus, Katz, Perlis …   Wikipedia

  • Pi — This article is about the number. For the Greek letter, see Pi (letter). For other uses, see Pi (disambiguation). The circumference of a ci …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”