From: Michael Chastain <mec.gnu@mindspring.com>
To: bob@brasko.net
Cc: gdb@sources.redhat.com
Subject: Re: GDB/MI Output Syntax
Date: Thu, 26 Aug 2004 14:01:00 -0000 [thread overview]
Message-ID: <412DED43.nail3XH31S08T@mindspring.com> (raw)
In-Reply-To: <20040825193659.GA19945@white>
Bob Rossi <bob@brasko.net> wrote:
> so far, it seems to parse everything I throw at it. However, I haven't
> tested it to much because I am building an intermediate representation.
> This is what I'll use from the front end.
How can we hook this up with the gdb test suite?
I've got a corpus of gdb.log files. Someone could write some Perl
script to pick out pieces and invoke your parser as an external program.
It might help to add a few more rules at the top:
session -> input_output_pair_list
input_output_pair_list -> epsilon | input_output_pair_list input output
input -> ...
The sticky part is that dejagnu mixes its own output into this.
Ick.
Getting into the grammar itself:
Comma separators and lists are kludgy. In these rules:
result_record -> opt_token "^" result_class result_list_prime
result_list_prime -> result_list | epsilon
result_list -> result_list "," result | "," result
The actual gdb output for a result_record could be either:
105^done
103^done,BreakPointTable={...}
It looks a little weird to me to parse the first comma as part
of result_list_prime. How about:
result_record -> opt_token "^" result_class
result_record -> opt_token "^" result_class "," result_list
result_list -> result | result_list "," result
That simplifies tuple and list as well:
tuple -> "{}" | "{" result_list "}"
list -> "[]" | "[" value_list "]" | "[ result_list ]"
That simplifies the rules also, because they won't need any special code
to construct a list for: "[" result result_list "]" .
This also gets rid of the foo_prime constructions, which can cause
trouble. The original oob_record_list_prime caused the original
shift/reduce conflict, because the parser had to decide whether to
reduce an epsilon to oob_record_list_prime or keep shifting and reduce
later to the non-epsilon form of the oob_record_list.
Style point: there is a lot of:
foo_list -> foo_list foo | epsilon
bar_list -> bar_list bar | bar
I think this is more readable:
foo_list -> epsilon | foo_list foo
bar_list -> bar | bar_list bar
Another nit: how is the grammar even working with:
nl -> CR | CR_LF
Doesn't this have to be:
nl -> LF | CR | CR LF
Or is the lexer quietly defining CR_LF to include "\n"?
For coding purposes it would be more efficient to make NL
a single token and have the lexer recognize all three forms.
For doco purposes it might be better to explicitly make nl
a non-terminal and show the LF, CR, CR LF terminals.
Either way is okay, but I'd like to have one or the other:
either have the lexer do all the work, or have the lexer be
stupid simple and have the grammar do the work.
Michael
next prev parent reply other threads:[~2004-08-26 14:01 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-25 15:44 Bob Rossi
2004-08-25 15:57 ` Michael Chastain
2004-08-25 19:37 ` Bob Rossi
2004-08-26 14:01 ` Michael Chastain [this message]
2004-08-26 18:31 ` Bob Rossi
2004-08-26 20:44 ` Michael Chastain
2004-08-26 20:52 ` Keith Seitz
2004-08-26 22:16 ` Michael Chastain
2004-08-26 22:03 ` Bob Rossi
2004-08-26 23:06 ` Michael Chastain
2004-08-26 21:13 ` Andrew Cagney
2004-08-26 21:25 ` Bob Rossi
2004-08-26 22:46 ` Michael Chastain
2004-08-27 10:14 ` Eli Zaretskii
2004-08-26 22:41 ` Michael Chastain
-- strict thread matches above, loose matches on Subject: below --
2005-01-06 0:28 Paul Schlie
2005-01-06 0:32 ` Kip Macy
2005-01-06 0:49 ` Paul Schlie
2005-01-06 1:10 ` Bob Rossi
2005-01-06 1:36 ` Paul Schlie
[not found] <1093622671.2836.ezmlm@sources.redhat.com>
2004-08-27 17:56 ` Jim Ingham
2004-08-27 19:12 ` Michael Chastain
2005-01-05 23:27 ` Bob Rossi
2005-01-06 4:48 ` Eli Zaretskii
2005-01-06 23:31 ` Bob Rossi
2005-01-07 0:36 ` Jim Ingham
2005-01-07 1:12 ` Bob Rossi
2005-01-07 3:12 ` Russell Shaw
2005-01-11 19:35 ` Bob Rossi
2005-01-13 2:23 ` Bob Rossi
2004-08-24 3:12 Bob Rossi
2004-08-24 4:15 ` Michael Chastain
2004-08-24 12:30 ` Bob Rossi
2004-08-24 12:50 ` Michael Chastain
2004-08-24 18:59 ` Andrew Cagney
2004-08-24 19:07 ` Bob Rossi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=412DED43.nail3XH31S08T@mindspring.com \
--to=mec.gnu@mindspring.com \
--cc=bob@brasko.net \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox