Formal Compiler Implementation in a Logical Framework
Abstract
The task of designing and implementing a compiler can be a difficult and error-prone process. In this paper, we present a new approach based on the use of higher-order abstract syntax and term rewriting in a logical framework. All program transformations, from parsing to code generation, are cleanly isolated and specified as term rewrites. This has several advantages. The correctness of the compiler depends solely on a small set of rewrite rules that are written in the language of formal mathematics. In addition, the logical framework guarantees the preservation of scoping, and it automates many frequently-occurring tasks including substitution and rewriting strategies. As we show, compiler development in a logical framework can be easier than in a general-purpose language like ML, in part because of automation, and also because the framework provides extensive support for examination, validation, and debugging of the compiler transformations. The paper is organized around a case study, using the MetaPRL logical framework to compile an ML-like language to Intel x86 assembly. We also present a scoped formalization of x86 assembly in which all registers are immutable.
Additional Information
© 2003 California Institute of Technology. Caltech Technical Report caltechCSTR:2003.002 April 29, 2003. This work was supported in part by the DoD Multidisciplinary University Research Initiative (MURI) program administered by the Office of Naval Research (ONR) under Grant N00014-01-1-0765, the Defense Advanced Research Projects Agency (DARPA), the United States Air Force, the Lee Center, and by NSF Grant CCR 0204193.Attached Files
Submitted - m-paper-tr.pdf
Submitted - m-paper-tr.ps
Files
Name | Size | Download all |
---|---|---|
md5:1928332a58a1fc2c29fbee7404ee0426
|
377.3 kB | Preview Download |
md5:7e62ab251fa3d9be297fe9c33628fc3b
|
454.7 kB | Download |
Additional details
- Eprint ID
- 27063
- Resolver ID
- CaltechCSTR:2003.002
- Office of Naval Research (ONR)
- N00014-01-1-0765
- Defense Advanced Research Projects Agency (DARPA)
- United States Air Force
- Caltech Lee Center for Advanced Networking
- NSF
- CCR-0204193
- Created
-
2003-07-02Created from EPrint's datestamp field
- Updated
-
2019-10-03Created from EPrint's last_modified field
- Caltech groups
- Computer Science Technical Reports