90 likes | 188 Views
The CERES compiler generator at DIKU (1982-84). Neil Fest, Aug. 2007. p. p. L → M N. Languages and compilers. Defn . A programming language L is a partial function L : A ( A * A ). We use the notation L-programs to mean Dom( L ).
E N D
The CERES compiler generator at DIKU (1982-84) Neil Fest, Aug. 2007
p p L→ M N Languages and compilers • Defn. A programming languageL is a partial function L: A (A* A). We use the notation L-programs to mean Dom(L). • Defn. Let L, M and N be programming languages. Then =n N-programs L = M○ (N(n)). L p i = M (N n p) i
Ld→ T T Compiler generation • Assume a set LangDef A of so-called language definitions and a function which maps every d LangDef to Ld, the language defined by d. • Compiler generation problem: how do we transform d into a compiler comp ?
Ld→ T T Compiler generator • Definition A T-program cocom is called a compiler generator if Dom(T(cocom))= LangDef and d LangDef, Tcocomd
→ T T → T T Ld→ T Ld→ T Ld→ T T Every compiler generator is a compiler • Definition A programming language with -programs = LangDef is said to be an implicit compiler defining language (i.c.d.l.) if d LangDef, d . • Theorem Let cocom be a compiler generator. Then there exits at least one i.c.d.l. which satisfies cocom . Note that compiler generation is then just compilation: Proof hint: = T o (T cocom) d comp cocom
→ T • → T • → T • → T T Defining in itself • Let us say that an i.c.d.l. is consistent, if there exists a definition such that L = . • If such a exists, then and one can generate at compiler generator by: cocom
Small and beautiful • : 2400 bytes (itself generated) • cocom: 6166 bytes (generated)
→ T The connection to partial evaluation • Let be defined by (d, p, x1,…,xn)= Ld p (x1,…,xn) • Lemma (Jones&Tofte 83/84?,unpublished): -programs: is a autoprojector for (, T) iff implicit compiler defining language for (,T) with
→ T The connection to partial evaluation • Let be defined by (d, p, x1,…,xn)= Ld p (x1,…,xn) • Lemma (Jones&Tofte 83/84?,unpublished): mix -programs: mix is a partial evaluator for (, T) iff metacompiling language for (,T) with mix