<s>
for	O
the	O
purpose	O
of	O
defining	O
the	O
ALGOL	B-Language
68	I-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
W-grammars	B-Application
are	O
two-level	O
grammars	O
:	O
they	O
are	O
defined	O
by	O
a	O
pair	O
of	O
grammars	O
,	O
that	O
operate	O
on	O
different	O
levels	O
:	O
</s>
<s>
the	O
hypergrammar	O
is	O
an	O
attribute	B-Application
grammar	I-Application
,	O
i.e.	O
</s>
<s>
The	O
set	O
of	O
strings	O
generated	B-General_Concept
by	O
a	O
W-grammar	B-Application
is	O
defined	O
by	O
a	O
two-stage	O
process	O
:	O
</s>
<s>
within	O
each	O
hyperrule	O
,	O
for	O
each	O
attribute	O
that	O
occurs	O
in	O
it	O
,	O
pick	O
a	O
value	O
for	O
it	O
generated	B-General_Concept
by	O
the	O
metagrammar	O
;	O
the	O
result	O
is	O
a	O
normal	O
context-free	O
grammar	O
rule	O
;	O
do	O
this	O
in	O
every	O
possible	O
way	O
;	O
</s>
<s>
The	O
consistent	O
substitution	O
used	O
in	O
the	O
first	O
step	O
is	O
the	O
same	O
as	O
substitution	O
in	O
predicate	O
logic	O
,	O
and	O
actually	O
supports	O
logic	B-Language
programming	I-Language
;	O
it	O
corresponds	O
to	O
unification	B-Algorithm
in	O
Prolog	B-Language
,	O
as	O
noted	O
by	O
Alain	O
Colmerauer	O
.	O
</s>
<s>
W-grammars	B-Application
are	O
Turing	B-Algorithm
complete	I-Algorithm
;	O
</s>
<s>
Curtailed	O
variants	O
,	O
known	O
as	O
affix	O
grammars	O
,	O
were	O
developed	O
,	O
and	O
applied	O
in	O
compiler	B-Language
construction	I-Language
and	O
to	O
the	O
description	O
of	O
natural	O
languages	O
.	O
</s>
<s>
Another	O
curtailed	O
version	O
of	O
W-grammars	B-Application
is	O
Prolog	B-Language
,	O
the	O
logic	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
This	O
work	O
influenced	O
the	O
design	O
and	O
implementation	O
of	O
programming	O
languages	O
,	O
most	O
notably	O
,	O
of	O
ALGOL	B-Language
60	I-Language
,	O
which	O
introduced	O
a	O
syntax	O
description	O
in	O
Backus	O
–	O
Naur	O
form	O
.	O
</s>
<s>
These	O
can	O
be	O
readily	O
expressed	O
in	O
W-grammars	B-Application
.	O
</s>
<s>
Programming	O
languages	O
have	O
the	O
analogous	O
notions	O
of	O
typing	O
and	O
scoping	B-Language
.	O
</s>
<s>
W-grammars	B-Application
are	O
based	O
on	O
the	O
idea	O
of	O
providing	O
the	O
nonterminal	O
symbols	O
of	O
context-free	O
grammars	O
with	O
attributes	O
(	O
or	O
affixes	O
)	O
that	O
pass	O
information	O
between	O
the	O
nodes	O
of	O
the	O
parse	O
tree	O
,	O
used	O
to	O
constrain	O
the	O
syntax	O
and	O
to	O
specify	O
the	O
semantics	O
.	O
</s>
<s>
Donald	O
Knuth	O
visited	O
the	O
ALGOL	B-Language
68	I-Language
design	O
committee	O
while	O
developing	O
his	O
own	O
version	O
of	O
it	O
,	O
attribute	B-Application
grammars	I-Application
.	O
</s>
<s>
Quite	O
peculiar	O
to	O
W-grammars	B-Application
was	O
their	O
strict	O
treatment	O
of	O
attributes	O
as	O
strings	O
,	O
defined	O
by	O
a	O
context-free	O
grammar	O
,	O
on	O
which	O
concatenation	O
is	O
the	O
only	O
possible	O
operation	O
;	O
complex	O
data	O
structures	O
and	O
operations	O
can	O
be	O
defined	O
by	O
pattern	B-Language
matching	I-Language
.	O
</s>
<s>
After	O
their	O
introduction	O
in	O
the	O
1968	O
ALGOL	B-Language
68	I-Language
"	O
Final	O
Report	O
"	O
,	O
W-grammars	B-Application
were	O
widely	O
considered	O
as	O
too	O
powerful	O
and	O
unconstrained	O
to	O
be	O
practical	O
.	O
</s>
<s>
This	O
was	O
partly	O
a	O
consequence	O
of	O
the	O
way	O
in	O
which	O
they	O
had	O
been	O
applied	O
;	O
the	O
1973	O
ALGOL	B-Language
68	I-Language
"	O
Revised	O
Report	O
"	O
contains	O
a	O
much	O
more	O
readable	O
grammar	O
,	O
without	O
modifying	O
the	O
W-grammar	B-Application
formalism	O
itself	O
.	O
</s>
<s>
Meanwhile	O
,	O
it	O
became	O
clear	O
that	O
W-grammars	B-Application
,	O
when	O
used	O
in	O
their	O
full	O
generality	O
,	O
are	O
indeed	O
too	O
powerful	O
for	O
such	O
practical	O
purposes	O
as	O
serving	O
as	O
the	O
input	O
for	O
a	O
parser	B-Language
generator	I-Language
.	O
</s>
<s>
They	O
describe	O
precisely	O
all	O
recursively	O
enumerable	O
languages	O
,	O
which	O
makes	O
parsing	O
impossible	O
in	O
general	O
:	O
it	O
is	O
an	O
undecidable	O
problem	O
to	O
decide	O
whether	O
a	O
given	O
string	O
can	O
be	O
generated	B-General_Concept
by	O
a	O
given	O
W-grammar	B-Application
.	O
</s>
<s>
Restricted	O
and	O
modified	O
variants	O
of	O
W-grammars	B-Application
were	O
developed	O
to	O
address	O
this	O
,	O
e.g.	O
</s>
<s>
Q-systems	B-General_Concept
,	O
also	O
applied	O
to	O
natural	O
language	O
processing	O
;	O
</s>
<s>
the	O
CDL	B-Application
series	O
of	O
languages	O
,	O
applied	O
as	O
compiler	B-Language
construction	I-Language
languages	O
for	O
programming	O
languages	O
.	O
</s>
<s>
A	O
W-grammar	B-Application
to	O
generate	O
only	O
the	O
valid	O
sentences	O
:	O
</s>
<s>
in	O
A	O
:	O
=	O
B/C	O
-v-q	O
×S	O
,	O
all	O
variables	O
must	O
be	O
numbers	O
;	O
</s>
<s>
This	O
(	O
non-context-free	O
)	O
requirement	O
can	O
be	O
expressed	O
in	O
a	O
W-grammar	B-Application
by	O
annotating	O
the	O
rules	O
with	O
attributes	O
that	O
record	O
,	O
for	O
each	O
variable	O
used	O
or	O
assigned	O
to	O
,	O
its	O
name	O
and	O
type	O
.	O
</s>
<s>
It	O
can	O
be	O
done	O
by	O
using	O
the	O
metagrammar	O
to	O
define	O
a	O
string	O
representation	O
for	O
the	O
data	O
structure	O
and	O
using	O
pattern	B-Language
matching	I-Language
to	O
define	O
operations	O
:	O
</s>
<s>
<LETTER>	O
::	O
==	O
a	O
|	O
b	O
|	O
c	B-Language
|	O
 [ ... ] 	O
</s>
<s>
The	O
ALGOL	B-Language
68	I-Language
reports	O
use	O
a	O
slightly	O
different	O
notation	O
without	O
<angled brackets>	O
.	O
</s>
<s>
c	B-Language
)	O
library	O
prelude	O
:	O
declaration	O
prelude	O
sequence	O
.	O
</s>
<s>
c	B-Language
)	O
NEST1	O
EXTERNAL	O
prelude	O
with	O
DECSETY1	O
:	O
</s>
<s>
One	O
may	O
wish	O
to	O
compare	O
the	O
grammar	O
in	O
the	O
report	O
with	O
the	O
Yacc	B-Application
parser	O
for	O
a	O
subset	O
of	O
ALGOL	B-Language
68	I-Language
by	O
Marc	O
van	O
Leeuwen	O
.	O
</s>
<s>
a	O
parser	O
for	O
a	O
large	O
class	O
of	O
W-grammars	B-Application
,	O
with	O
example	O
grammars	O
for	O
expressions	O
,	O
eva	O
,	O
sal	O
and	O
Pascal	B-Application
(	O
the	O
actual	O
ISO	B-Application
7185	I-Application
standard	O
for	O
Pascal	B-Application
uses	O
extended	O
Backus	O
–	O
Naur	O
form	O
)	O
.	O
</s>
<s>
Dick	O
Grune	O
created	O
a	O
C	B-Language
program	I-Language
that	O
would	O
generate	O
all	O
possible	O
productions	O
of	O
a	O
W-grammar	B-Application
.	O
</s>
<s>
The	O
applications	O
of	O
EAGs	O
mentioned	O
above	O
can	O
effectively	O
be	O
regarded	O
as	O
applications	O
of	O
W-grammars	B-Application
,	O
since	O
EAGs	O
are	O
so	O
close	O
to	O
W-grammars	B-Application
.	O
</s>
<s>
W-grammars	B-Application
have	O
also	O
been	O
proposed	O
for	O
the	O
description	O
of	O
complex	O
human	O
actions	O
in	O
ergonomics	O
.	O
</s>
