On Sun, 18 Jul 2010, Panayiotis Karabassis wrote:

> The problem is that I would like to select different start symbols at
> run-time.

Where start is your original start symbol, extend your grammar like this:

  start_extended:
    start
  | TK_EXPRESSION expression
  | TK_FOO foo
  ;

At run-time, if you want to test expression, set a flag that causes your 
scanner to return TK_EXPRESSION before scanning the input.  Likewise for 
foo and TK_FOO.

A push parser makes this even easier because you can push TK_EXPRESSION or 
TK_FOO to the parser before pull-parsing the rest of the input stream, so 
you don't have to implement flags to direct the scanner.  However, we 
haven't implemented push parsing for C++ yet.

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

Reply via email to