Git Product home page Git Product logo

pykit's Introduction

pykit

Pykit is a package for a pluggable intermediate representations, that is higher level and easier to use than LLVM. You can think of it as a toolbox of several parts:

* an IR
* a number of builtin compiler analyses, transformations and optimizations
* a C and LLVM code generator
* a set of builtin opcodes

Pykit ships with a set of builtin opcodes and types for which the compiler passes and code generator are defined. However, one is entirely free to use one's own opcodes, or mix higher level opcodes with lower level ones defined by pykit.

For instance, flypy starts with a higher-level set of opcodes, and uses a number of passes from pykit while still using a good number of its own opcodes. For instance, when the IR is still untyped and there are abstract opcodes such as "retrieve this attribute from this object" is uses the dataflow pass to translate variable writes and reads into SSA.

In additionl to pluggable opcodes, the optimizations and passes are often pluggable, for instance the sparse conditional constant propagation pass is parameterized by a constant folder. The aim is flexibility and abstraction, i.e. to reduce the burden for new compilers to support multiple backends (e.g. C or LLVM), to serialize and cache IR, to generate debug information, exception handling and potentially GC root finding, and so forth.

Pykit also has an IR verifier and interpreter for that set of operations. The IR is a function of basic blocks containing instructions (operations), similar to three-address code. One can refer to the arguments as well as the uses of an instruction.

Although pykit ships with builtin opcodes and passes, one is entirely free to use a custom set of opcodes, types and transformations.

To summarize, pykit:

* lowers and optimizes intermediate code
* tries to be independent from platform or high-level language
* can generate LLVM or C89 out of the box
    - todo: finish C codegen :)
* supports pluggable opcodes
* has a number of builtin optimizations and transformations
* has a builtin set of goodies to work with the IR
    - builder, interpreter, verifier
* supports float and complex math functions through llvmmath

pykit is inspired by VMKit and LLVM.

Website

http://pykit.github.io/pykit/

Documentation

http://pykit.github.io/pykit-doc/

pykit's People

Contributors

gdementen avatar jaberg avatar markflorisson avatar mwiebe avatar sklam avatar

Watchers

 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.