Proceedings ArticleDOI
Very fast LR parsing
Thomas J. Pennello
- Vol. 21, Iss: 7, pp 145-151
Reads0
Chats0
TLDR
LR parsers can be made to run 6 to 10 times as fast as the best table-interpretive LR parsers, and a factor of 2 to 4 increase in total table size can be expected, depending upon whether syntactic error recovery is required.Abstract:
LR parsers can be made to run 6 to 10 times as fast as the best table-interpretive LR parsers. The resulting parse time is negligible compared to the time required by the remainder of a typical compiler containing the parser.A parsing speed of 1/2 million lines per minute on a computer similar to a VAX 11/780 was achieved, up from an interpretive speed of 40,000 lines per minute. A speed of 240,000 lines per minute on an Intel 80286 was achieved, up from an interpretive speed of 37,000 lines per minute.The improvement is obtained by translating the parser's finite state control into assembly language. States become code memory addresses. The current input symbol resides in a register and a quick sequence of register-constant comparisons determines the next state, which is merely jumped to. The parser's push-down stack is implemented directly on a hardware stack. The stack contains code memory addresses rather than the traditional state numbers.The strongly-connected components of the directed graph induced by the parser's terminal and nonterminal transitions are examined to determine a typically small subset of the states that require parse-time stack-overflow-check code when hardware does not provide the check automatically.The increase in speed is at the expense of space: a factor of 2 to 4 increase in total table size can be expected, depending upon whether syntactic error recovery is required.read more
Citations
More filters
Book
Partial evaluation and automatic program generation
TL;DR: This paper presents a guide to the literature the self-applicable scheme specializer, a partial evaluator for a subset of scheme for a first-order functional languages.
Book ChapterDOI
Algorithms for finding patterns in strings
TL;DR: This chapter discusses the algorithms for solving string-matching problems that have proven useful for text-editing and text-processing applications and several innovative, theoretically interesting algorithms have been devised that run significantly faster than the obvious brute-force method.
Journal ArticleDOI
Approximate matching of regular expressions
Eugene W. Myers,Webb Miller +1 more
TL;DR: An algorithm to solve the problem in time O(MN), where M and N are the lengths of A and R, and requires only O(N) space to deliver just the score of the best alignment, superior to an earlier algorithm by Wagner and Seiferas.
Journal ArticleDOI
A Four Russians algorithm for regular expression pattern matching
TL;DR: This work places a new worst-case upper bound on regular expression pattern matching using a combination of the node-listing and “Four-Russians” paradigms and provides an implementation that is faster than existing software for small regular expressions.
Book ChapterDOI
Faster Generalized LR Parsing
John Aycock,R. Nigel Horspool +1 more
TL;DR: Tomita devised a method of generalized LR (GLR) parsing to parse ambiguous grammars efficiently, falling back on more expensive general techniques when necessary.
References
More filters
Book
Compilers: Principles, Techniques, and Tools
TL;DR: This book discusses the design of a Code Generator, the role of the Lexical Analyzer, and other topics related to code generation and optimization.
Yacc : Yet Another Compiler Compiler
S. C. Johnson,Murray Hill +1 more
TL;DR: Yacc provides a general tool for describing the input to a computer program, together with code to be invoked as each such structure is recognized, and turns such a specification into a subroutine that handles the input process.
Proceedings ArticleDOI
A new method for compiler code generation
TL;DR: An algorithm is given to translate a relatively low-level intermediate representation of a program into assembly code or machine code for a target computer and techniques are given to prove the correctness of the translator.
Journal ArticleDOI
Efficient Computation of LALR(1) Look-Ahead Sets
Frank DeRemer,Thomas J. Pennello +1 more
TL;DR: Two relations that capture the essential structure of the problem of computing LALR(1) look-ahead sets are defined, and an efficient algorithm is presented to compute the sets in time linear in the size of the relations.
Journal ArticleDOI
Optimization of parser tables for portable compilers
TL;DR: Six methods for parser table compression are compared and Experimental results on eleven different grammars show that, on the average, a method based on graph coloring turns out best.