|LRGen: LR(1) parser generator|
|Home Downloads Feedback Comparison Theory Papers Documentation Contact|
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).
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.
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.|