Stack and Queue Based Parser Approach for Parsing Expression Grammar
Shravankumar Purve, Purva Gogte, Roshni Bhave · 2023
Parsing Expression Grammar (PEG) and Packrat Parser are the two recent developments in the field of Formal Languages and Automata Theory. The syntax of PEG is similar to the syntax of Context free grammar with ordered choice. It is based on backtracking recursive-descent parser. Packrat parsing technique is used for handling backtracking in recursive decent parser. Backtracking operation in parsing Expression Grammar ensure in polynomial time at huge memory cost. Recursive Descent parsers (RD) are top-down parsing technique in which derivation of string follows the structure of the grammar. It is very easy to write and debug. Recursive Descent parsers admit very limited class of grammar. It is extended by using recursive decent parser with backtracking which takes explosive runtimes. It cannot used for the grammar with left recursion. It also cannot deal with ambiguous grammar. We develop stack based parsing technique which is recursive descent-like. It takes cubic time in worst case. It may be parse even for left recursion grammar.