[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Call a non-start production
From: |
Panayiotis Karabassis |
Subject: |
Re: Call a non-start production |
Date: |
Sun, 18 Jul 2010 20:13:46 +0300 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100620 Icedove/3.0.5 |
Thank you for you response!
The problem is that I would like to select different start symbols at
run-time.
For example to have a function
parse(start_symbol, string)
So that can I write unit tests like
ASSERT_PARSES_CORRECTLY(parse(EXPRESSION, "3+2=4"))
%start would set the start symbol once and for all for the generated parser.
But again thank you very much for your response.
Regards,
Panayiotis
On 07/18/2010 07:47 PM, Hans Aberg wrote:
On 18 Jul 2010, at 15:38, Panayiotis Karabassis wrote:
In my parser I have several productions. The start production is
named "program". Further down I have a production named "expression"
etc. For testing purposes I would like to parse a string using
"expression" as the start production. Is this possible? My parser is
a C++ parser.
Perhaps you might try %start (see the Bison manual) and ignore any
messages about unreachable states.
Hans