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




_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to