> On 7 Jul 2016, at 14:47, Alexander Barkov <b...@mariadb.org> wrote:

> In our application we need to have two parsers using:
> 
> - the same yylex function (the tokenizer)
> - the same set of terminal symbols (%token)
> - the same YYSTYPE structure (%union)
> 
> but implementing very different syntax rules.

One other possibility might be to implement two grammars headed by two dummy 
tokens not used otherwise:
  start:
      "foo" grammar1
    | "bar” grammar2
  ;

  grammar1: …

  grammar2: …

When the parsers start, insert one of the tokens first to select the grammar.



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

Reply via email to