In article <652@ima.ISC.COM> Stanley Shebs writes:>Two-level grammars have the same problem that attribute grammars do ->they are based on the belief that the world is linear strings of tokens.>Sooner or later, simple grammars don't work, so people have introduced>some pretty bizarre schemes to patch things up. (My first response to>attribute grammars was the word "kludge".)

It has always seemed to me that attribute grammars, based as they are on
the parse tree, are a step up from linear strings of tokens.

My two complaints about AG are:
1) Because they generate long-distance dependencies (e.g. the type of
an identifier depends on a declaration, *somewhere*) the
evaluation is expensive (without optimizing tricks).
2) Attribute evaluator generators that I have seen have been too closely
tied to particular languages. For instance, one that I know
of generates a monolithic Pascal program. Suppose you would
prefer Modula 2, in several compilation units, or Ada, or C...?
Too bad.

Can someone propose an alternative to attribute grammars, as a
way to specify context-sensitive syntax in a form suitable
for machine processing? I would be interested to know. The
answer doesn't have to solve the *whole* problem of compilation;
if you can bite off a substantial chunk, that's worth while.