## A Monadic Multi-stage Metalanguage (2003)

### Cached

### Download Links

- [www.disi.unige.it]
- [www.cs.nott.ac.uk]
- [www.macs.hw.ac.uk]
- [www.disi.unige.it]
- DBLP

### Other Repositories/Bibliography

Citations: | 16 - 7 self |

### BibTeX

@MISC{Moggi03amonadic,

author = {E. Moggi and S. Fagorzi},

title = {A Monadic Multi-stage Metalanguage},

year = {2003}

}

### Years of Citing Articles

### OpenURL

### Abstract

We describe a metalanguage MMML, which makes explicit the order of evaluation (in the spirit of monadic metalanguages) and the staging of computations (as in languages for multi-level binding-time analysis). The main contribution of the paper is an operational semantics which is sufficiently detailed for analyzing subtle aspects of multi-stage programming, but also intuitive enough to serve as a reference semantics. For instance, the separation of computational types from code types, makes clear the distinction between a computation for generating code and the generated code, and provides a basis for multi-lingual extensions, where a variety of programming languages (aka monads) coexist. The operational semantics consists of two parts: local (semantics preserving) simplification rules, and computation steps executed in a deterministic order (because they may have side-effects). We focus on the computational aspects, thus we adopt a simple type system, that can detect usual type errors, but not the unresolved link errors. Because of its explicit annotations, MMML is suitable as an intermediate language.

### Citations

566 | A syntactic approach to type soundness
- Wright, Felleisen
- 1994
(Show Context)
Citation Context ... the step of computation among those in Table 2. The following properties of Subject Reduction (SR) and Progress are typical for reduction semantics. The progress property is phrased differently from =-=[WF94], beca-=-use we have two relations (simplification and computation), and the latter includes successful termination (and run-time link error). Theorem 5.5 (SR for > ) If Σ1; ∆1 ⊢ (x1|µ1, e1, E1) and (x1|... |

484 | The chemical abstract machine - Berry, Boudol - 1992 |

257 |
Combinatory reduction systems
- Klop
- 1980
(Show Context)
Citation Context ...lti-Stage Metalanguage We define the syntax of a monadic multi-stage metalanguage MMML. For the sake of generality the syntax of terms is given in the framework of Combinatory Reduction Systems (CRS) =-=[Klo80]-=-. The syntax of terms must be fixed, in order to define configurations, simplification and computation. Therefore, we consider a concrete example corresponding to a functional language with references... |

250 | Multi-stage programming with explicit annotations - Taha, Sheard - 1997 |

196 | A modal analysis of staged computation - Davies, Pfenning |

112 | A calculus of module systems - Ancona, Zucca - 2002 |

100 | The marriage of effects and monads - Wadler - 1998 |

94 | A metalanguage for programming with bound names modulo renaming
- Pitts, Gabbay
- 2000
(Show Context)
Citation Context ...nd dn(cV ([xi]ei|i ∈ m)) > c([xi]dn(ei)|i ∈ m) incompatible with the typing dn: 〈τ〉⇒Mτ. Besides the closed-type and region-based approaches, we believe that the type systems for nominal ca=-=lculi (e.g. [PG00]-=-) are very promising not only for providing a more accurate typing for dn, but also for extending MMML with intensional analysis, i.e. the ability to analyze code. [Nan02] provides the best attempt to... |

88 | Multi-Stage Programming: Its Theory and Applications - Taha - 1999 |

83 | A temporal-logic approach to binding-time analysis - Davies - 1996 |

74 | Accomplishments and research challenges in meta-programming
- Sheard
- 2001
(Show Context)
Citation Context ...(that we do not recall). In the rest of this section we discuss related work, design choices, variations, and open issues. A more general discussion of open issues in meta-programming can be found in =-=[She01]. Comparison -=-with λ ○ and λ M of [Dav96]. MMML borrows code types from λ ○ (and MetaML) and annotated term-constructors from λ M . In MMML an annotation is a sequence b ∈ {V, M} ∗ , while in λ M is a ... |

72 | 1.4: A non-strict, purely functional language - Haskell - 1997 |

63 | Efficient multi-level generating extensions for program specialization
- Glück, Jorgensen
- 1995
(Show Context)
Citation Context ...those terms with level-annotations, that Taha wanted to avoid. Partial evaluation. The term annotation used in MMML is directly related to that used in multi-level languages for binding-time analysis =-=[GJ95]-=-. A monadic metalanguage has been used in [HD97] to formalize Partial Evaluation (PE), when the object language has computational effects. In PE one wants to ensure correctness of the specializer. The... |

60 | A reflection on call-by-value
- Sabry, Wadler
- 1997
(Show Context)
Citation Context ...ue is (v ∗ 1, v ∗ 2). If v 0 i = ret(v∗ i ) is provable (from the axioms for computational types), then it is easy to prove also (v1, v2) 0 = ret(v1, v2) ∗ . We have not tried to exploit the i=-=deas in [SW96] to-=- make the CBV translation better behaved w.r.t. reductions. We are doubtful that it can be done easily, because the definition of value in MetaML is so complex. Lemma 6.4 If v ∈ V n , then v n β.do... |

44 | Environment classifiers - Taha, Nielsen - 2003 |

39 | Meta-programming with names and necessity
- Nanevski, Pfenning
- 2003
(Show Context)
Citation Context ...ems for nominal calculi (e.g. [PG00]) are very promising not only for providing a more accurate typing for dn, but also for extending MMML with intensional analysis, i.e. the ability to analyze code. =-=[Nan02]-=- provides the best attempt to address the typing issues in a comprehensive manner, but it does not explicitly consider computational effects. Is cM definable? One may wonder whether there is a need to... |

38 | Lambda calculus with explicit recursion - Ariola, Klop - 1997 |

34 | Closed types for a safe imperative MetaML
- Calcagno, Moggi, et al.
(Show Context)
Citation Context ... theoretical research on multi-stage programming languages has focused on type systems for preventing those errors caused by subtle interactions between code generation and computational effects (see =-=[CMSar]). In -=-this paper, we want to provide a deeper understanding of the computational aspects of multi-stage programming, in the framework of a metalanguage with computational types Mτ and code types 〈τ〉: ... |

34 | A computational formalization for partial evaluation
- Hatcliff, Danvy
- 1997
(Show Context)
Citation Context ...nted to avoid. Partial evaluation. The term annotation used in MMML is directly related to that used in multi-level languages for binding-time analysis [GJ95]. A monadic metalanguage has been used in =-=[HD97]-=- to formalize Partial Evaluation (PE), when the object language has computational effects. In PE one wants to ensure correctness of the specializer. Therefore, monadic types are used to identify those... |

31 | A sound reduction semantics for untyped CBN multi-stage computation. or, the theory of MetaML is non-trivial (extended abstract
- Taha
(Show Context)
Citation Context ...t preventing those errors, that in MetaML are statically detected by the use of closed types and dead-code annotations. There is limited work on sound equational reasoning in the presence of staging. =-=[Tah00]-=- discusses the problems, and provide a simple solution, which avoids explicit level-annotations, by identifying well-behaved subsets of terms and values. Unfortunately, his solution does not seem to s... |

30 | Monads, effects and transformations
- Benton, Kennedy
- 1999
(Show Context)
Citation Context ...tantially the computational effects that may occur within the scope of a binder, in particular the computational effects are invisible outside the scope of the binder. Monadic intermediate languages. =-=[BK99]-=- advocates the use of MIL for expressing optimizing transformations. Also MMML could be used for this purpose, but for having non-trivial optimizations one may have to introduce more aggressive simpli... |

28 | Monadic encapsulation of effects: a revised approach (extended version
- Moggi, Sabry
(Show Context)
Citation Context ...mplification (described by local rewrite rules) and computation (that may cause sideeffects). This style of presentation is directly inspired by the distinction between pure and monadic evaluation in =-=[MS01]. ��-=-� Supported by MIUR project NAPOLI and EU project DART IST-2001-33477 1sSummary. Section 2 describes the syntax of MMML, including program configurations, and the operation of demotion vc↓, giving t... |

26 | D.: Partial evaluation for higher-order languages with state
- Thiemann, Dussart
- 1996
(Show Context)
Citation Context ...unctional language with references. This choice is particularly appropriate for relating to previous work on imperative multi-stage programming languages [CMSar] and on imperative two-level languages =-=[TD99]. • Types τ, C -=-is a type-constructor with arity #C given by a natural number τ ∈ T: : = X | Mτ | 〈τ〉 | C(τ) with |τ| = #C for the concrete example we consider two type-constructors: – → of arity 2 for... |

18 | Normalization by Evaluation for the Computational Lambda-Calculus - Filinski - 2001 |

15 | Sound specialization in the presence of computational effects - Lawall, Thiemann - 1997 |

12 | Metalanguages and applications - Moggi - 1997 |

5 | and René Vestergaard: Equational reasoning for linking with first-class primitive modules - Wells - 2000 |

4 | Type specialization for imperative languages - Dussart, Hughes, et al. - 1997 |

4 | and René Vestergaard. Confluent equational reasoning for linking with first-class primitive modules (long version). A short version is [WV00]. Full paper, 3 appendices of proofs - Wells - 1999 |

1 | Monads and effects. Lecture notes for Int - Benton, Hughes, et al. - 2000 |

1 | BHM00] [BK99] [CMSar] [Dav96] [DP96] [GJ95] [Klo80 - Benton, Hughes, et al. - 2000 |