• https://doi.org/10.14279/depositonce-4736Copy DOI Icon

Type sound syntactic language extension

Show More
  • Abstract
  • Literature Map
  • References
  • Similar Papers
Abstract

Syntactic programming language extension provides a high level of abstraction, considerably reduces boilerplate code, adapts a programming language to a specific application area, and is an essential tool to manage complexity and to increase the productivity of the software development process. Syntactic language extensions are commonly implemented by rewriting or desugaring them into code of the base language at compile time. To form a sustainable abstraction, the desugaring of extended code must not introduce type errors in the generated code. These type errors are a serious threat to the usability of syntactic abstraction: they are reported in terms of the generated code leading to a leaky abstraction, they are often hard to find, and it is often unclear if the use site or the definition site of the extension is defective. In this thesis, we develop the language extension system and method SoundX (Sound eXtensions) for statically typed programming languages. SoundX is language independent and follows the “extensions as libraries” approach of Sugar* [ER13]. It derives a syntactically extensible language dialect from a formal base language definition. A base language definition comprises the context-free syntax and the type system of the base language. The type system is specified by inductively defined judgements using inference rule schemata. Extensions consist of additional syntax, the desugaring into the base language, and new typing rules for the extended code that act as an interface of the extension. Extensions are free to add new phrases to all syntactic sorts of the base language like terms, types, or declarations. SoundX uses the typing rules of the base language and the extension to type check the extended program prior to desugaring. In this way, type errors are reported relative to the original sugared program and the desugaring can employ type information during the code generation. This allows the implementation of extensions that require type inference and significantly increases the expressiveness of SoundX compared to purely syntactical transformations. To process the type information in the code generator, SoundX maps typing derivations instead of plain expressions of the extended language to typing derivations of the base language using a novel derivation-centred desugaring procedure. SoundX guarantees that the desugaring of an extension results in welltyped code. To this end, it automatically verifies that the desugarings and the typing rules are sound with respect to each other. We formally prove that the SoundX verification procedure is sufficient to ensure that a valid derivation in the extended language is mapped to a valid derivation in the base language by establishing a Preservation theorem and characterise under which conditions such a resulting derivation exists using a Progress theorem. According to the “extensions as libraries” paradigm, extensions are scoped by the module system and activated by importing them. Independently defined extension are composed on import and it is possible to use one extension as the target of another extension enabling incremental extension [EGR12]. The SoundX verification procedure verifies an extension modularly and it is not necessary to re-verify the composition of extensions. SoundX is implemented as a plugin for the Sugar* framework providing an integration into the Eclipse IDE. The implementation contains a pragmatically inspired but principled solution to the practically relevant problem of fresh name generation during code generation and a variation of the resolution algorithm to obtain an explicit representation of a derivation tree. Moreover, it includes a general and type system independent procedure to locate and report type errors, which returns adequate and understandable error message in practice. We demonstrate the applicability and expressiveness of SoundX by several case studies using a base language built on the Simply-Typed λ-Calculus.

Similar Papers
  • Research Article
  • Citations31

An illumination of the template enigma : software code generation with templates

  • Nov 18, 2015
  • Data Archiving and Networked Services (DANS)
  • B J Arnoldus
  • Research Article
  • Citations13

Concrete syntax definition for modeling languages

  • Jan 01, 2007
  • Infoscience (Ecole Polytechnique Fédérale de Lausanne)
  • Frédéric Fondement
  • Supplementary Content
  • Citations28

A mechanization of sorted higher-order logic based on the resolution principle

  • Jan 01, 1994
  • Publications of the UdS (Saarland University)
  • Michael Kohlhase
  • Research Article
  • Citations3

Incremental attribute evaluation for multi-user semantics-based editors

  • Jan 01, 1992
  • Columbia Academic Commons (Columbia University)
  • Josephine Micallef
  • Research Article
  • Citations32

An Active Events Model for Systems Monitoring

  • Jan 01, 2001
  • Columbia Academic Commons (Columbia University)
  • Philip N Gross +4
  • Supplementary Content

Modularisierung und Wiederverwendung durch generische Klassen in Object Teams

  • Dec 19, 2013
  • DepositOnce
  • Andreas Mertgen
  • Conference Article
  • Citations4

Multi-dimensional dependency grammar as multigraph description

  • Jan 01, 2006
  • Publications of the UdS (Saarland University)
  • Ralph Debusmann +1
  • Research Article
  • Citations8

Domain Engineering and Generic Programming for Parallel Scientific Computing

  • Nov 14, 2002
  • DepositOnce
  • Jens Gerlach
  • Research Article
  • Citations1

Higher-Order Subtyping with Type Intervals

  • Jan 01, 2017
  • Infoscience (Ecole Polytechnique Fédérale de Lausanne)
  • Sandro Stucki
  • Conference Article
  • Citations1

A Type Checker for a Logical Framework with Union and Intersection Types

  • May 14, 2020
  • DROPS (Schloss Dagstuhl – Leibniz Center for Informatics)
  • Claude Stolze +1
  • Research Article
  • Citations2

Foncteurs de Mackey projectifs

  • Jan 01, 2008
  • Infoscience (Ecole Polytechnique Fédérale de Lausanne)
  • Muriel Nicollerat
  • Research Article

The event generator SHERPA

  • Jan 01, 2005
  • CERN Document Server (European Organization for Nuclear Research)
  • T Gleisberg +5
  • Research Article

TOWARD EASING THE INSTANTIATION OF APPLICATIONS USING GRENJ FRAMEWORK BY MEANS OF A DOMAIN SPECIFIC LANGUAGE

  • Dec 27, 2011
  • Vinícius H S Durelli +3
  • Conference Article
  • Citations2

Inlining of mathematical functions in HP-UX for Itanium® 2

  • Mar 23, 2003
  • James W Thomas
  • Supplementary Content
  • Citations109

Names and higher-order functions

  • May 02, 1994
  • Apollo (University of Cambridge)
  • Ian Stark
Cactus Communications logo

Copyright 2026 Cactus Communications. All rights reserved.