I have seen attribute grammars for a small handful of tasks:

  • Parsing simple arithmetical expressions
  • Type checking
  • Checking that a variable is initialized
  • anbncn (seems to be a favorite toy example)...

and that's about it.

What are some practical uses of attribute grammars outside of the field of compilers? I've seen CFG's being used in program synthesis, computational biology, computational linguistics, and computational music - are attribute grammars anywhere near as useful?

In addition, I'd appreciate some more theoretical intuition about what kinds of context-sensitive languages can be made parseable using attribute grammars, and what are beyond the reach of such grammars.

  • $\begingroup$ You can use attributes to represent linguistic properties such as agreement. (I'm not sure how you could do without them for that kind of thing). $\endgroup$ – Bruce Adams Dec 28 '18 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.