In computer science, a Van Wijngaarden grammar (also vW-grammar or W-grammar[1]) is a formalism for defining formal languages. The name derives from the formalism invented by Adriaan van Wijngaarden[2] for the purpose of defining the ALGOL 68 programming language. The resulting specification[3] remains its most notable application.
Van Wijngaarden grammars address the problem that context-free grammars cannot express agreement or reference, where two different parts of the sentence must agree with each other in some way. For example, the sentence "The birds was eating" is not Standard English because it fails to agree on number. A context-free grammar would parse "The birds was eating" and "The birds were eating" and "The bird was eating" in the same way. However, context-free grammars have the benefit of simplicity whereas van Wijngaarden grammars are considered highly complex.[4]