The Essential Haskell Compiler

On the same subject as the Scheme compiler in 90 Minutes, is the Essential Haskell Compiler. From the HC&AR summary:

The purpose of the EHC project is to provide a description a Haskell compiler which is as understandable as possible so it can be used for education as well as research

In order to avoid overwhelming the innocent reader, the description of the compiler is organised as a series of increasingly complex steps. Each step corresponds to a Haskell subset which itself is an extension of the previous step. The first step starts with the essentials, namely typed lambda calculus.

Sounds like BC Pierce's Types and Programming Languages.
Also notable is that EHC uses Utrecht's Attribute Grammars, which are interesting in their own right.

Rel: an open source implementation of Date & Darwen's Tutorial D

More from Slashdot, which today points to an article on Rel, Dave Voorhis' open source implementation of Tutorial D (see Chris Date and Hugh Darwen's The Third Manifesto for a discussion of the rationale behind this language).

Voorhis explains his motives for creating the implementation in an article on the (currently somewhat sparse) Rel Wiki.

Discussions of possible replacements of, or improvements on, SQL usually end up being all about the powerful institutional/human factors (or "network effects") that will impede acceptance of any new solution. Refreshingly, Voorhis is going ahead and building one anyway, without waiting for approval from the masses. It might catch on, or it might not; at least someone's giving it a go.

Generalized ADTs in Haskell

Simon Peyton-Jones, via Haskell-list:

I've finished my first attempt at implementing Generalised Algebraic
Data types in GHC. Ordinary algebraic data types are generalised to
allow you to write an explicit type signature for each constructor; for

     data Term a where
	Lit :: Int -> Term Int
	Succ :: Term Int -> Term Int
	IsZero :: Term Int -> Term Bool	
	If :: Term Bool -> Term a -> Term a -> Term a

Notice that some of these constructors have return types that are not
just "Term a"... that's the whole point! Now you can write typed
evaluator for these terms:

    eval :: Term a -> a
    eval (Lit i)		= i
    eval (Succ t) 	= 1 + eval t
    eval (IsZero i) 	= eval i == 0
    eval (If b e1 e2)	= if eval b then eval e1 else eval e2

This is implementation of the "wobbly types" we've discussed before in GHC, slated for release in version 6.4. Simon also give a pointer to Tim Sheard's site, as he's done a lot of related work. There I found an interesting looking paper on Omega, a language which takes the GADT idea even further.

Smalltalk 80: Green Book

The text for Smalltalk-80, Bits of History, Words of Advice is now available online. The text documents the development history of the Smalltalk 80 language.

  • Part One of this book is a collection of papers that provide some
    background and history of the Smalltalk-80 implementation.
  • In Part Two we present papers that describe the experiences four
    implementors had in bringing their systems to life.
  • Part Three is a collection of measurements made by the
    implementation groups.
  • In Part Four we present papers that look toward the future of
    Smalltalk systems and propose ideas for extending the Smalltalk-80
    system beyond its initial form.

via Cincom Smalltalk Blogs.

Acute: high-level programming language design for distributed computation

Acute: high-level programming language design for distributed computation

This work is exploring the design space of high-level languages for distributed computation, focussing on typing, naming, and version change. We have designed, formally specified and implemented an experimental language, Acute. This extends an OCaml core to support distributed development, deployment, and execution, allowing type-safe interaction between separately-built programs. It is expressive enough to enable a wide variety of distributed infrastructure layers to be written as simple library code above the byte-string network and persistent store primitives, disentangling the language runtime from communication.

This requires a synthesis of novel and existing features:

  • type-safe interaction between programs, with marshal and unmarshal primitives;
  • dynamic loading and controlled rebinding to local resources;
  • modules and abstract types with abstraction boundaries that are respected by interaction;
  • global names, generated either freshly or based on module hashes: at the type level, as runtime names for abstract types; and at the term level, as channel names and other interaction handles;
  • versions and version constraints, integrated with type identity;
  • local concurrency and thread thunkification; and
  • second-order polymorphism with a namecase construct.
The language design deals with the interplay among these features and the core. The semantic definition tracks abstraction boundaries, global names, and hashes throughout compilation and execution, but still admits an efficient implementation strategy.

For more info, see the Main site, from which you can view papers and sample code.

Icon Language Implementation and Unicon News

Icon has always impressed me as the most elegant and useful string processing language. In fact, I still use it. The speed impresses me to this day. Lately the out-of-print Implementation of the Icon Programming Language book went online as a PDF download. Not only that, the copyright is public domain.

The successor language Unicon has published the first issue of The Generator, a journal devoted to that language. Unicon is an open-source project. Therefore code from the Icon implementation book lives in Unicon's public code repository. What Unicon adds to Icon is OO, POSIX, and other goodies.

My own plea is for language folks to study (Un-)Icon's string scanning mechanisms. How I wish they were more common. No matter what my task or language du jour, I always find myself longing for Icon when it comes to strings. Doug Bagley offers some OCaml libraries which imitate Icon string techniques.

Types in CMUCL

CMU Common Lisp's compiler, known as Python, has a sophisticated implementation of Common Lisp's powerful type system. The system primarily enforces type safety at runtime, but it also performs static type inference. The static type information is used to detect type errors, eliminate unnecessary runtime type checks, and select efficient primitive code (e.g. avoid excessively generic arithmetic).

CMUCL's history stretches back around twenty years, though I believe the compiler was rewritten "just" 15 odd years ago. The system is still widely used, notably by ITA software as publicised by Paul Graham.

XML feed