Generalized Bottom Up Parsers With Reduced Stack Activity

  • Authors:
  • Elizabeth Scott;Adrian Johnstone

  • Affiliations:
  • Department of Computer Science, Royal Holloway, University of London, Egham, Surrey TW20 0EX, UK;Department of Computer Science, Royal Holloway, University of London, Egham, Surrey TW20 0EX, UK

  • Venue:
  • The Computer Journal
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

Abstract

We describe a generalized bottom up parser in which non-embedded recursive rules are handled directly by the underlying automaton, thus limiting stack activity to the activation of rules displaying embedded recursion. Our strategy is motivated by Aycock and Horspool's approach, but uses a different automaton construction and leads to parsers that are correct for all context-free grammars, including those with hidden left recursion. The automaton features edges which directly connnect states containing reduction actions with their associated goto state: hence we call the approach reduction incorporated generalized LR parsing. Our parser constructs shared packed parse forests in a style similar to that of Tomita parsers. We give formal proofs of the correctness of our algorithm, and compare it with Tomita's algorithm in terms of the space and time requirements of the running parsers and the size of the parsers' tables. Experimental results are given for standard grammars for ANSI-C, ISO-Pascal; for a non-deterministic grammar for IBM VS-COBOL, and for a small grammar that triggers asymptotic worst case behaviour in our parser.