TY - JOUR
T1 - Operational Semantics-Directed Compilers and Machine Architectures
AU - Hannan, John
PY - 1994/1/7
Y1 - 1994/1/7
N2 - We consider the task of automatically constructing intermediate-level machine architectures and compilers generating code for these architectures, given operational semantics for source languages. We use operational semantics in the form of abstract machines given by rewrite systems in which the rewrite rules operate on terms representing states of computations. To construct compilers and new architectures we employ a particular strategy called pass separation, a form of staging transformation, that takes a program p and constructs a pair of programs p1, p2 such that p1994 = p2(p1(x), y)) for all x,y. If p represents an operational semantics for a language, with arguments x and y denoting a source program and its input data, then pass separation constructs programs p1 and p2 corresponding to a compiler and an executor. The compiler translates the source language into an intermediate-level target language, and the executor provides the definition for this language. Our use of pass separation supports the automatic definition of target languages or architectures, and the structure of these architectures is directed by the structure of the given source semantics. These architectures resemble abstract machine languages found in hand-crafted compilers. Our method is restricted to a limited class of abstract machines given as term-rewriting systems, but we argue that this class encompasses a large set of language definitions derived from more natural operational semantics. We provide two examples of our method by constructing compilers and target architectures for a simple functional language and a simple imperative language. Though we construct these architectures automatically, they bear a striking resemblance to existing architectures constructed by hand.
AB - We consider the task of automatically constructing intermediate-level machine architectures and compilers generating code for these architectures, given operational semantics for source languages. We use operational semantics in the form of abstract machines given by rewrite systems in which the rewrite rules operate on terms representing states of computations. To construct compilers and new architectures we employ a particular strategy called pass separation, a form of staging transformation, that takes a program p and constructs a pair of programs p1, p2 such that p1994 = p2(p1(x), y)) for all x,y. If p represents an operational semantics for a language, with arguments x and y denoting a source program and its input data, then pass separation constructs programs p1 and p2 corresponding to a compiler and an executor. The compiler translates the source language into an intermediate-level target language, and the executor provides the definition for this language. Our use of pass separation supports the automatic definition of target languages or architectures, and the structure of these architectures is directed by the structure of the given source semantics. These architectures resemble abstract machine languages found in hand-crafted compilers. Our method is restricted to a limited class of abstract machines given as term-rewriting systems, but we argue that this class encompasses a large set of language definitions derived from more natural operational semantics. We provide two examples of our method by constructing compilers and target architectures for a simple functional language and a simple imperative language. Though we construct these architectures automatically, they bear a striking resemblance to existing architectures constructed by hand.
UR - http://www.scopus.com/inward/record.url?scp=0028463582&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=0028463582&partnerID=8YFLogxK
U2 - 10.1145/183432.183458
DO - 10.1145/183432.183458
M3 - Article
AN - SCOPUS:0028463582
SN - 0164-0925
VL - 16
SP - 1215
EP - 1247
JO - ACM Transactions on Programming Languages and Systems (TOPLAS)
JF - ACM Transactions on Programming Languages and Systems (TOPLAS)
IS - 4
ER -