From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4340 invoked by alias); 26 Aug 2004 22:03:56 -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 4332 invoked from network); 26 Aug 2004 22:03:54 -0000 Received: from unknown (HELO lakermmtao10.cox.net) (68.230.240.29) by sourceware.org with SMTP; 26 Aug 2004 22:03:54 -0000 Received: from white ([68.9.64.121]) by lakermmtao10.cox.net (InterMail vM.6.01.03.02.01 201-2131-111-104-103-20040709) with ESMTP id <20040826220352.KXKW16005.lakermmtao10.cox.net@white>; Thu, 26 Aug 2004 18:03:52 -0400 Received: from bob by white with local (Exim 3.35 #1 (Debian)) id 1C0SLY-0005dh-00; Thu, 26 Aug 2004 18:03:52 -0400 Date: Thu, 26 Aug 2004 22:03:00 -0000 From: Bob Rossi To: Michael Chastain Cc: gdb@sources.redhat.com Subject: Re: GDB/MI Output Syntax Message-ID: <20040826220352.GB21451@white> Mail-Followup-To: Michael Chastain , gdb@sources.redhat.com References: <20040825154348.GA19533@white> <412CB6B6.nail1DX11BPYQ@mindspring.com> <20040825193659.GA19945@white> <412DED43.nail3XH31S08T@mindspring.com> <20040826183134.GA20902@white> <412E4B96.nailMU21D4LDE@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <412E4B96.nailMU21D4LDE@mindspring.com> User-Agent: Mutt/1.3.28i X-SW-Source: 2004-08/txt/msg00403.txt.bz2 On Thu, Aug 26, 2004 at 04:44:06PM -0400, Michael Chastain wrote: > Grammar comments: > > === > > Can you write the terminal symbols in ALL CAPS; > that's the usual style for bison grammars. > > I think the terminals are: > > STRING C_STRING CR LF TOKEN > "(gdb)" "^" "*" "+" "=" "," "~" "@" "&" > "done" "running" "connected" "error" "exit" > "stopped" > > The literal strings are okay as is, but I'd really like > symbolic terminals capitalized. Done. I would prefer remove all string literals. Or make rules for them. gdb -> "(gdb)" done -> "done" Any thoughts? > > === > > Hmmm, in my gdb.log, there is a space in "(gdb) ^M", but in > the gdb.texinfo grammar and the new grammar, there is no space. My lexer ignores whitespace, [ \t\v\f] {} is this bad? we could note in the doco that the grammar doesn't care about whitespace. Or, we could fix GDB in that case? > === > > In the result_record rules: > > result_record -> opt_token "^" result_class > result_record -> opt_token "^" result_class "," opt_result_list > > In the second form, if there is a ",", there must be at least > one result. So the last symbol should be result_list rather > than opt_result_list. > Done, and this is great because it remove the dependency of opt_result_list. It is no longer needed. > === > > Same deal with the async_output rule: > > async_output -> async_class "," opt_result_list > > This should be like result_record. If opt_result_list is empty > then there is no "," . Example: > > 403*stopped^M > (gdb) ^M > > In fact async_output doesn't add much value to the grammar. > How about just: > > async_record -> opt_token async_record_class async_class > async_record -> opt_token async_record_class async_class "," result_list Very very good. Done. Personally, this grammar seems much easier for me to understand, however, I will look at it more to see if it can be reduced or simplified anymore. Here is an update that still seems to work with bison. Andrew, do you like the idea of starting with a grammar like this, and then showing it in the style that's on the webpage? Or what do you have in mind? opt_output_list -> epsilon | output_list output_list -> output | output_list output output -> opt_oob_record_list opt_result_record "(gdb)" nl opt_oob_record_list -> epsilon | opt_oob_record_list oob_record nl opt_result_record -> epsilon | result_record nl result_record -> opt_token "^" result_class result_record -> opt_token "^" result_class "," result_list oob_record -> async_record | stream_record async_record -> opt_token async_record_class async_class async_record -> opt_token async_record_class async_class "," result_list async_record_class -> "*" | "+" | "=" result_class -> "done" | "running" | "connected" | "error" | "exit" async_class -> "stopped" result_list -> result | result_list "," result result -> variable "=" value variable -> STRING value_list -> value | value_list "," value value -> C_STRING | tuple | list tuple -> "{}" | "{" result_list "}" list -> "[]" | "[" value_list "]" | "[" result_list "]" stream_record -> stream_record_class C_STRING stream_record_class -> "~" | "@" | "&" nl -> CR | LF | CR LF opt_token -> epsilon | TOKEN BTW, I don't have any string literals in my real grammar. I return tokens from the parser for each of this. So, I have "(gdb)" -> GDB token -> INTEGER_LITERAL CR | LF | CR LF -> NEWLINE is this pertinant? Thanks, Bob Rossi