LRGen: LR(1) parser generator


Home Downloads Feedback Comparison Theory Papers Documentation Contact

LRGen: LR(1) parser generator v 9.2

  • Creates LR(1) parsers in
  • C++
  • Handles context-sensitivity (e.g. typedef in C)
  • yes
  • Reads grammar notation with EBNF operators (+,*,?)
  • yes
  • Parsers have a symbol-table builder
  • yes
  • Parsers can do AST construction and traversal
  • yes
  • Grammars are separate from code
  • yes
  • Includes Visual Studio IDE Community projects
  • 2 projects
  • BNF grammars included
  • C grammar
  • Parser speed
  • 2% faster than Bison parsers.
  • Single-user license fee
  • free

    DFA: fast lexer generator v 9.2 (included with LRGen)

  • Creates DFA lexical analyzers in
  • C++
  • Lexers do keyword recognition
  • yes
  • Single-user license fee
  • free

    LR(1) Parsers

    An LR(1) parser generator creates a minimal LR(1) parser. If the grammar is LALR(1), you will get an LALR(1) parser. If the grammar is LR(1), you wil get an LR(1) parser, which will be slightly larger than LALR(1), because there are usually not many states that require LR(1).

    Context Sensitivity

    The "typedef" declaration in the C and C++ languages is a context sensitive issue.  This cannot be solved by upgrading from LALR(1) to LR(1) or LR(k).  It requires making use of a symbol table while parsing and this allows even an LALR(1) parser to handle this context sensitive issue.  LRGen has this feature built into the grammar notation, making life easy for a user.

    DFA Lexical Analyzers

    A DFA lexer is a finite-state automata without a pushdown stack (i.e. not a PDA).  DFA is the fastest recognition algorithm (5 times the speed of PDA's).  A DFA algorithm does not use any lookahead characters.  Because it is not a PDA, it cannot handle "nested" comments or any type of "nested" input (e.g. [[a]]).  However, DFA's work fine for most programming languages.  Afterall, the job of handling "nested" types of input usually belongs to the parser.

    Parser Speed

    When using a C99 grammar, I discovered that the C99 parser created by LRGen+DFA was 2% faster than the C99 parser created by Bison+Flex. This test measured lexing and parsing speed, without creating a symbol table and AST.  Parser size is nearly the same for both products.

    (c) Copyright Paul B Mann 2018.  All rights reserved.