pa-ba / reg-machine

Coq & Haskell code for Calculating Correct Compilers II

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calculating compilers for register machines

This repository contains the supplementary material for the paper Calculating Correct Compilers II: Return of the Register Machines by Patrick Bahr and Graham Hutton. The material includes Coq formalisations of all calculations in the paper along with the full Haskell source code of the calculated compilers. In addition, we also include Coq formalisations for calculations that were mentioned but not explicitly carried out in the paper.

Coq formalisation

The Coq formalisation is located in the coq subfolder. Below we list the Coq files for the calculations from the paper and the specification of the memory model:

  • Memory.v: the (axiomatic) memory model (Section 2)
  • Arith.v: arithmetic expressions (section 3)
  • Exception.v: arithmetic expressions + exceptions (section 4)
  • Lambda.v: call-by-value lambda calculus (section 5)

We also include compiler calculations for additional languages:

The remaining files are used to define the Coq tactics to support reasoning in calculation style and to provide auxiliary concepts:

  • Tactics.v: tactics for calculation style proofs
  • Machine.v: auxiliary definitions and tactics for virtual machines
  • LinearMemory.v: instantiation of the memory model (thus proving its consistency)
  • ListIndex.v: definitions to index elements in a list

Haskell code

The haskell subfolder contains the source code of the three compilers calculated in the paper:

  • arith.lhs: arithmetic expressions (section 3)
  • except.lhs: arithmetic expressions + exceptions (section 4)
  • lambda.lhs: lambda calculus (section 5)

About

Coq & Haskell code for Calculating Correct Compilers II


Languages

Language:Coq 76.5%Language:Makefile 17.8%Language:Haskell 5.8%