[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can one prune the parse stack?
From: |
Christoph Lechner |
Subject: |
Re: Can one prune the parse stack? |
Date: |
Thu, 26 Aug 2010 23:08:32 +0200 |
User-agent: |
Thunderbird 1.5.0.9 (X11/20061206) |
Mike Aubury wrote:
> I'm thinking your grammar is probably wrong - there shouldn't be any
> problem with having lots of packets like that - so long and they are
> not very recursive (packet within packet within packet .....)
> What does your grammar look like ?
@Mike: Sorry for sending my first reply to you and not to the list. So
here is my mail to the list.
Hi,
thank you for your fast reply. I think I found the mistake now -- I
guess it's the 'stream' rule.
The beginning of my grammar is like:
stream: /* empty line */
| stmt stream
| error stream
;
stmt: LANGLE assignment_list RANGLE { /* here the data of the
command is available */ }
;
assignment_list:
assignment
| assignment SEMIKOLON assignment_list
;
[..]
So, I think I identified my mistake. When I remove the top 'stream' rule
and make 'stmt' the new top rule, is it supposed to work then?
As I think about it now, my grammar is more like one does when parsing a
programming language. There, the all the statements as a whole form the
program, so one needs something like my 'stream' rule. But here the
statements are independent, so now I think the 'stream' rule isn't
necessary.
When I make stmt the new top rule, is yyparse supposed to exit (and
clean up), once it parsed a single statement?
Am I correct?
CU
- Christoph