A fast general parser for automatic code generation

  • Authors:
  • Wuu Yang

  • Affiliations:
  • National Chiao-Tung University, Taiwan, Republic of China

  • Venue:
  • MTPP'10 Proceedings of the Second Russia-Taiwan conference on Methods and tools of parallel programming multicomputers
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

The code generator in a compiler attempts to match a subject tree against a collection of tree-shaped patterns for generating instructions. Tree-pattern matching may be considered as a generalization of string parsing. We propose a new generalized LR (GLR) parser, which extends the LR parser stack with a parser cactus. GLR explores all plausible parsing steps to find the least-cost matching. GLR is fast due to two properties: (1) duplicate parsing steps are eliminated and (2) partial parse trees that will not lead to a least-cost matching are discarded as early as possible.