Re: GDB/MI Output Syntax ambiguity

Michael Chastain
2004-08-23T21:42:51Z

It's been a while since I wrote a yacc grammar, but my inclination
would be to enhance the lexer and distinguish some new terminals:

TOKEN-UPARROW
TOKEN-STAR
TOKEN-PLUS
TOKEN-EQUALS

Then the grammar goes from LALR(2) to LALR(1), because
result-record can start with TOKEN-UPARROW, which is just
one symbol, rather than token "^", which is two symbols.
That ought to make it yacc-parseable.

That keeps the token numbers in the natural place.

With drow's rule:

output -> [token] ( out-of-band-record-1 [token] )* [ result-record ] "(gdb)" nl

This is also LALR(1), but the token symbol is not bundled with
the wrong out-of-band-record-1, so the tree-value-constructing
code gets a little skewed.

But I'm rusty on all this.