A new parsing method for non-LR(1) grammars

Autor: A. Gayler Harford, Michael G. Main, Vincent P. Heuring
Rok vydání: 1992
Předmět:
Zdroj: Software: Practice and Experience. 22:419-437
ISSN: 1097-024X
0038-0644
DOI: 10.1002/spe.4380220505
Popis: One of the difficult problems that faces a compiler writer is to devise a grammar that is suitable for both efficient parsing and semantic attribution. This paper describes a system that resolves conflicts in LR(1) parsing by taking advantage of information in the parse tree. The system, which functions as part of a compiler generator, rewrites the user's grammar to remove parsing conflicts. It then places code into the generated compiler that rewrites the parse tree during parsing so as to produce the tree of the original grammar. The compiler writer can then write the semantic attribution to fit his or her original grammar without any knowledge of the changes made. The method is expected to be efficient in most cases, even in parsing systems that do not explicitly build the entire parse tree. The method complements previous work in its capabilities and advantages. The system has been implemented and integrated into a compiler generator system.
Databáze: OpenAIRE