This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: GDB/MI Output Syntax ambiguity
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb at sources dot redhat dot com
- Date: Mon, 23 Aug 2004 17:09:24 -0400
- Subject: Re: GDB/MI Output Syntax ambiguity
- References: <20040823210314.GA15374@white>
On Mon, Aug 23, 2004 at 05:03:14PM -0400, Bob Rossi wrote:
> Hi,
>
> I am generating a bottom up parser for 'GDB/MI Output Syntax' using
> bison. Unfortunately, I think that I found an ambiguity, which makes it
> not easily parsable. Please correct me if I am wrong.
>
> output -> ( out-of-band-record )* [ result-record ] "(gdb)" nl
> result-record -> [ token ] "^" result-class ( "," result )* nl
> out-of-band-record -> async-record | stream-record
> async-record -> exec-async-output | status-async-output | notify-asyn
> exec-async-output -> [ token ] "*" async-output
> status-async-output -> [ token ] "+" async-output
> notify-async-output -> [ token ] "=" async-output
>
> I am assuming that the grammar above for 'output' means that there can
> be 0 or more 'out-of-band-record', followed by 0 or 1 'result-record',
> followed by '(gdb)' and then a newline.
This is easily solved. For instance, factor the optional token out of
async-record and result-record, and handle output as:
output -> [token] ( out-of-band-record-1 [token] )* [ result-record ] "(gdb)" nl
I'm not sure how faithful to the documented grammar GDB is... but
that's a separate problem.
--
Daniel Jacobowitz