Git Product home page Git Product logo

cumin2salt's Introduction

Compiler from CuMin to SaLT

This implements a translation from the functional-logic language CuMin to the lower-level language SaLT. These programming languages and the translation are described in detail in my bachelor's thesis.

I currently don't maintain this project anymore.

Example run

The CuMin input program

length :: forall a. List a -> Nat
length list = case list of
  Nil -> 0
  Cons x xs -> 1 + length<:a:> xs

is automatically translated (after optimizations) to

length :: forall a. Set (List a -> Set Nat)
length = {\list_56 :: List a -> case list_56 of
    Nil -> {0}
    Cons x_57 xs_58 -> length<:a:> >>= (\arg_59 :: (List a
                                           -> Set Nat) -> arg_59 xs_58 >>=
      (\primOpArg_60 :: Nat -> {1 + primOpArg_60}))}

A manual translation gives the same result (up to variable renaming):

length :: forall a. Set (List a -> Set Nat)
length = { \list :: List a -> case list of
  Nil -> {0}
  Cons x xs -> length<:a:> >>=
    \length' :: (List a -> Set Nat) ->
    length' xs >>= \l :: Nat -> {1 + l} }

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.