Back in college (1988, I think), we used a tool called Linguist, which was
a really nifty attribute grammar system. I don't recall whether it had any
lexing capabilities, but it was the most BNF-looking thing I've ever seen.
You could define a set of attributes for nonterminals, and pass them
bidirectionally through the grammar something like: