From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21279 invoked by alias); 23 Aug 2004 21:09:25 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 21269 invoked from network); 23 Aug 2004 21:09:25 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 23 Aug 2004 21:09:25 -0000 Received: from drow by nevyn.them.org with local (Exim 4.34 #1 (Debian)) id 1BzM4C-00069k-Rz for ; Mon, 23 Aug 2004 17:09:24 -0400 Date: Mon, 23 Aug 2004 21:09:00 -0000 From: Daniel Jacobowitz To: gdb@sources.redhat.com Subject: Re: GDB/MI Output Syntax ambiguity Message-ID: <20040823210924.GA22417@nevyn.them.org> Mail-Followup-To: gdb@sources.redhat.com References: <20040823210314.GA15374@white> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040823210314.GA15374@white> User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-08/txt/msg00298.txt.bz2 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