Giter Club home page Giter Club logo

hindley-milner-exercise's Introduction

Running and Testing

  1. git clone https://github.com/ulan/hindley-milner-exercise.git
  2. cd hindley-milner-exercise
  3. cabal test
  4. cabal build
  5. ./dist/build/hindley-milner-exercise/hindley-milner-exercise < your-program-source.txt

The language

A term of the language is one of:

  • A variable - any sequence of letters (except one of the keywords).
  • A lambda application - two terms separated by a white space.
  • A lambda abstraction - written as "\variable . term"
  • A (non-recursive) let expression - written as "let variable = (term1) in term2", where the variable doesn't occur in term1 and paranthesis around term1 cannot be omitted.
  • A fix expression - written as "fix variable . term", where the variable may occur in the term. Its semantic is given by "fix x . M --> M[x := fix x . M]" (monomorphic type inference for 'fix' is enough)
  • A parenthesized expression - written as "(term)". Allows expressions like (x z) (y z).
  • Integer (decimal) constant.
  • Boolean constant: true | false.

Builtins:

  • cmp : Number -> Number -> Bool - comparison.
  • add : Number -> Number -> Number - addition.
  • sub : Number -> Number -> Number - subtraction.
  • mul : Number -> Number -> Number - multiplication.
  • div : Number -> Number -> Number - division.
  • if : forall a . Bool -> a -> a -> a - conditional.

hindley-milner-exercise's People

Contributors

ulan avatar

Watchers

 avatar  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.