what type of parser is bison. is it a LALR(1) or LR(1) ?
Bison is a general-purpose parser generator that converts a grammar description (Bison Grammar Files) for an LALR(1) context-free grammar into a C program to parse that grammar. The Bison parser is a bottom-up parser.
Bison is a general-purpose parser generator that converts an annotated context-free grammar into an LALR(1) or GLR parser for that grammar. The generated parser is implemented as a C or C++ program with a parsing function that can be called from application programs.
It is a simple hand-written recursive-descent parser with variable (but small) lookahead.
Bison reads a specification in the BNF notation (a context-free language), warns about any parsing ambiguities, and generates a parser that reads sequences of tokens and decides whether the sequence conforms to the syntax specified by the grammar.
Short answer: both.
By default, it produces LALR(1) parsers.
With the explicit option %glr-parser
, it'll produce an LR(1) parser.
Yep, since version 2.5, Bison does support several types of LR parsers: LALR(1), canonical LR(1), and IELR(1). See the documentation about "lr.type", for instance here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With