Coder Social home page Coder Social logo

flitersc's Introduction

F-liter Supercompiler

Debug variant. Build Status

A reimplementation of the Bollingbroke & Peyton-Jones (2010) compiler for the F-liter language in an attempt to understand it better. Currently packaged as a library and as is.

Try;

$ ghci Supercompiler
λ> ex_mapmap
main  = let x = Nil
        in sc x
sc x = let y = inc
       in
          let z = map y x
          in map y z
map x y = case y of
            Nil  -> Nil
            Cons z p -> let
                            q = x z
                            r = map x p
                        in Cons q r
inc x = let y = 1
        in x + y
λ> sc_wrapper ex_mapmap ("sc", lam "xs" $ fun "sc" @: "xs")
...

It will supercompile the function sc of program ex_mapmap with an unknown input.

Extra debug features

To aid debugging, the Debug.RocketFuel library prematurely terminates supercompilation when a predetermined "fuel" supply is depleted. This a very unsafe implementation of the concept introduced in Whalley's (1994) Automatic isolation of compiler errors.

By default, the fuel tank is infinite (i.e. Nothing).

  • fuelTank is a global variable.
  • disableTank creates infinite fuel.
  • fillTank n creates a finite pool of n units of fuel.
  • consumeFuel empty full will consume 1 unit of fuel. If the tank is depleted, it returns empty, otherwise full.
  • readTank returns the fuel tank value.

flitersc's People

Contributors

jasonreich avatar

Stargazers

Tommy Thorn avatar  avatar

Watchers

 avatar James Cloos avatar

flitersc's Issues

Remove similarly dull states (see #4)

Turns out there are similar things that should be left. For example;

f x y = case x of
          A  -> B x
          B z -> let p = A
                 in g y p
g x y = case x of
          A  -> B y
          B z -> f z x
main  = let
            x = let x = A
                in B x
            y = let
                    x = A
                    y = A
                in g x y
        in f x y
Terminated: B @[()]

f x y = case x of
          A  -> B x
          B z -> let p = A
                 in g y p
g x y = case x of
          A  -> B y
          B z -> h2 x z
h1 x = B x
h2 x y = case y of
           A  -> h1 y
           B z -> case x of
                    A  -> let p = A
                          in B p
                    B p -> h2 x p
main  = let
            x = let x = A
                in B x
            y = let
                    x = A
                    y = A
                in g x y
        in f x y

Tests: user error (@21404: Failed on optimisation! 52 < 54)

No need to tie forward

If we're using equivalence then the 'future' state will be able to tie back to this one.

Possible problem with mapping

s0 'instanceOf' s1 so there is a mapping m and a list of extra things in s1. So what happens if s1 references heap elements which are brought into s0 but overwrite it?

Probably not a problem outside of proof.

Eliminate identity functions

These seem to be caused by tying unknown variables. E.g. h1 in @5.6744

f x y = case x of
          A  -> y
          B  -> x
main  = let
            x = A
            y = let
                    x = B
                    y = A
                in f x y
        in f x y
Terminated: B

f x y = case x of
          A  -> y
          B  -> h1 x
h1 x = x
main  = let
            x = A
            y = let
                    x = B
                    y = A
                in f x y
        in f x y

Tests: user error (@6744: Failed on optimisation! 25 < 29)

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.