Skip to main content

A Fast General Parser for Automatic Code Generation

  • Conference paper
Methods and Tools of Parallel Programming Multicomputers (MTPP 2010)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6083))

Included in the following conference series:

  • 635 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Aho, A.V., Ganapathi, M., Tjian, S.W.K.: Code Generation Using Tree Matching and Dynamic Programming. ACM Transactions on Programming Languages and Systems 11(4), 491–516 (1989)

    Article  Google Scholar 

  2. Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers, Principles, Techniques, and Tools, 2nd edn. Addison-Wesley, New York (2007)

    Google Scholar 

  3. Christopher, T.W., Hatcher, P.J., Kukuk, R.C.: Using Dynamic Programming to Generate Optimized Code in a Graham-Glanville-Style Code Generator. In: Proceedings of the 1984 SIGPLAN symposium on Compiler construction, ACM SIGPLAN Notices, vol. 84, pp. 25–36. ACM, New York (1984)

    Chapter  Google Scholar 

  4. Earley, J.: An efficient context-free parsing algorithm. ACM Comm. 13(2), 94–102 (1970)

    Article  MATH  Google Scholar 

  5. Fischer, C.N., LeBlanc Jr., R.J.: Crafting a Compiler with C. Benjamin/Cummings, Reading (1991)

    Google Scholar 

  6. Fraser, C.W., Hanson, D.R., Proebsting, T.A.: Engineering a Simple, Efficient Code Generator Generator. ACM Letters on Programming Languages and Systems 1(3), 213–226 (1992)

    Article  Google Scholar 

  7. Glanville, R.S.: A machine independent algorithm for code generation and its use in retargetable compilers. Ph.D. dissertation, University of California, Berkeley (December 1977)

    Google Scholar 

  8. Steven Glanville, R., Graham, S.L.: A new method for compiler code generation. In: Proceedings of 5th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, Tucson, Arizona, pp. 231–254 (1978)

    Google Scholar 

  9. Nigel Horspool, R.: An Alternative to the Graham-Glanville Code-Generation Method. IEEE Computers 20, 33–39 (1987)

    Google Scholar 

  10. Madhavan, M., Shankar, P.: Optimal regular tree pattern matching using pushdown automata. In: Arvind, V., Sarukkai, S. (eds.) FST TCS 1998. LNCS, vol. 1530, pp. 122–133. Springer, Heidelberg (1998)

    Google Scholar 

  11. Madhavan, M., Shankar, P., Rai, S., Ramakrishna, U.: Extending Graham-Glanville Techniques for Optimal Code Generation. ACM Transactions on Programming Languages and Systems 22(6), 973–1001 (2000)

    Article  Google Scholar 

  12. Sun Microsystems, Connected, Limited Device Configuration, Specification Version 1.0a, Java 2 Platform Micro Edition 1.0a, CA, USA (May 19, 2000)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Yang, W. (2010). A Fast General Parser for Automatic Code Generation. In: Hsu, CH., Malyshkin, V. (eds) Methods and Tools of Parallel Programming Multicomputers. MTPP 2010. Lecture Notes in Computer Science, vol 6083. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-14822-4_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-14822-4_4

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-14821-7

  • Online ISBN: 978-3-642-14822-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics