GithubHelp home page GithubHelp logo

lambda-ccc's Introduction

Convert lambda expressions to CCC combinators and then to circuits.

See instructions in test/Tests.hs.

Dependencies:

  • The circat library for circuit specification, display, and conversion to netlists.

To try out:

  • cabal install circat and lambda-ccc (in that order)
  • In lambda-ccc/test, follow the directions in the module comment (near the top) in Simple.hs.

If all works, you'll see something like the following output:

hermit Simple.hs -v0 -opt=LambdaCCC.Reify +Simple Auto.hss resume && ghc -O2 --make SimpleMain.hs && ./SimpleMain
[starting HERMIT v0.4.0.0 on Simple.hs]
% ghc Simple.hs -fforce-recomp -O2 -dcore-lint -fsimple-list-literals -fexpose-all-unfoldings -fplugin=LambdaCCC.Reify -fplugin-opt=LambdaCCC.Reify:-v0 -fplugin-opt=LambdaCCC.Reify:Simple: -fplugin-opt=LambdaCCC.Reify:Simple:Auto.hss -fplugin-opt=LambdaCCC.Reify:Simple:resume -v0
Linking SimpleMain ...
\ (a,b) -> let h = \ f -> f a b in (h (&&),h xor)
(apply . (exr &&& curry ((&&) . exr)) &&& apply . (exr &&& curry (xor . exr))) . (id &&& curry (apply . (apply . (exr &&& exl . exr . exl) &&& exr . exr . exl))) . (it &&& id)

The output lines (after "Linking SimpleMain ...") are

  • A lambda expression corresponding to the body of a reified Haskell definition from Simple.hs, and
  • A CCC expression constructed by converting that lambda expression.

Additionally, you'll get a PDF with a picture of the program/circuit in out/test.pdf (also displayed in a PDF viewer) and Verilog code in out/test.v.

lambda-ccc's People

Contributors

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