Giter Site home page Giter Site logo

pcf2's Introduction

PCF2

A Haskell implementation of a Programming Computable Functions (PCF) interpreter with a Hindley-Milner style type system.

This is a statically typed lambda calculus with Booleans, natural numbers, and a fix operator for general recursion. It is based on material from "Types and Programming Languages" by Benjamin Pierce. The evaluation strategy is call-by-value.

Stack (>= 1.4.0) is required. See example.cf for an example program. To run it, type "stack build && stack exec PCF2-exe example.cf" in the root project directory.

Some basic logical and arithmetic functions are defined in prelude.cf. They can be imported by using 'import prelude'. The import feature is very basic -- it simply inlines the imported file in the place of the import command. Imported files can't import other files, so if they depend on other files you must make sure to import them manually and in the correct order.

A program is a sequence of commands, each of which is either a bind or eval command (not counting imports).

  • bind - assign a term to a name in the global environment, so that the name may appear free in the terms of subsequent commands.
  • eval - evaluate a term. Guaranteed by the type system to reduce to a value, given that it doesn't diverge.

The result of the last command is displayed by the interpreter. It can be either bind or eval -- the result of a bind is a (Id, Term) pair; the result of an eval is the value resulting from reducing a term.

pcf2's People

Contributors

bagnalla avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.