GithubHelp home page GithubHelp logo

dbremner / cozy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cozysynthesizer/cozy

0.0 2.0 0.0 554 KB

The collection synthesizer

Home Page: http://cozy.uwplse.org

Shell 0.91% Python 96.21% Java 2.88%

cozy's Introduction

                                     Cozy
                          The Collection Synthesizer

--------------------------------------------------------------------------------

    Cozy is a tool that synthesizes collection data structure implementations
    from very high-level specifications.

GETTING STARTED

    Dependencies:
        Python 2.7              - https://www.python.org/
        Z3 Python bindings      - https://github.com/Z3Prover/z3

    To check for the necessary dependencies, you can run:
        $ ./check.sh

    To get help:
        $ python src/main.py --help

    To run the tool:
        $ python src/main.py [options] [input-file]

    The synthesizer may run for a very long time in some cases. To stop it,
    press Ctrl+C and the tool will stop and output the best implementation
    found so far. Alternatively, you can pass a timeout value to the tool.

EXAMPLES

    Sample input files live in the "examples" folder.

    Some of the interesting examples are:
        graph               - a multigraph data structure
        simple-sort         - a data structure requiring sorting on its results
        neq                 - efficient lookup of elements NOT equal to a value

INPUT FORMAT

    If you want to craft your own inputs for Cozy, the input format is very
    simple. Each input file consists of:
      - some fields with names and types
      - optional assumptions about those fields
      - a set of query method specifications
      - an optional autotuning program

    Fields are declared using
        fields name1:type1, name2:type2, ...

    The types are treated as opaque strings and Cozy will blindly write
    them into the generated source code.

    Assumptions are declared using
        assume expr

    Top-level assumptions can only talk about record fields. They state
    conditions about individual records---i.e. preconditions for the
    generated `add()` method. The resulting data structure does not check
    these preconditions at runtime, but the synthesizer may be able to exploit
    them to generate faster code. (See examples/myria-profiling-api.)

    Query methods are declared using
        query query_name (arg1:type1, arg2:type2, ...)
            assume expr1
            assume expr2
            condition-expr
            sort field_name

    Query assumptions are optional. They state preconditions for the generated
    method. The resulting data structure does not check these preconditions at
    runtime, but the synthesizer may be able to exploit them to generate faster
    code. (See examples/myria-profiling-api.)

    The condition-expr states what records should be returned by the query
    method.

    The sort declaration is optional and, if present, requires that the
    resulting data set be sorted by some particular field. (See
    examples/simple-sort.)

    Autotuning programs are declared using
        costmodel file.java

    See the inputs in the examples folder for inspiration.

HACKING

    Source code lives in src. It is well-organized, but poorly commented.

        src/
            main.py       -- program entry point
            synthesis.py  -- synthesis algorithm
            codegen.py    -- code generation
            structures/   -- data structure library
            ...

    There are a few scripts useful for developers:

        Run pylint:    ./lint.sh
        Run tests:     ./test.sh
        Run fuzzer:    ./fuzz.sh

cozy's People

Contributors

calvin-l avatar dperelman avatar haomingl 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.