GithubHelp home page GithubHelp logo

retronym / inc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from davidgregory084/inc

0.0 2.0 0.0 371 KB

Experiments with incremental compiler construction on the JVM

License: Apache License 2.0

Scala 95.05% Java 4.50% C++ 0.45%

inc's Introduction

inc

Build Status License

Experiments with An Incremental Approach to Compiler Construction on the JVM.

Disclaimer

This is a hobby project. Expect lots of bugs and don't expect to be able to use this for anything useful.

Getting started

This project is built with mill version 0.3.6 and requires Java 8 or above to be installed.

To build the project:

mill _.compile

To run the test suite:

mill _.test

To build an executable at the root of the repo:

mill main.generateRunScript

You should be able to use this executable to compile your own programs.

See the help text for details of the command line interface:

$ ./inc --help
inc 0.1.0-SNAPSHOT
Usage: inc [options] <file>

  --help
  --version
  -cp, --classpath <value>
                           The classpath to use when compiling. Defaults to the current directory.
  -d, --destination <value>
                           The destination directory for compilation output. Defaults to the current directory.
  --trace-typer            Print a trace during the typechecking phase
  --print-parser           Print syntax trees after the parsing phase
  --print-resolver         Print syntax trees after the name resolution phase
  --print-typer            Print syntax trees after the type inference phase
  --print-codegen          Print the java bytecode generated by the code generation phase
  --print-timings          Print the time taken in each phase
  --verify-codegen         Run a verifier on the code produced in codegen
  <file>                   The source file to compile

Language features

Modules

module Test {}

Let bindings and literals

module Test.Let {
  let litInt = 42
  let litLong = 42L
  let litFloat = 42.0F
  let litDouble = 42.0D
  let litBool = true
  let litChar = 'a' 
  let litString = "foo"
  let litUnit = ()
}

If expressions

module Test.If {
  let choose = if true then 1 else 0
}

Functions

module Test.Func {
  let id = a -> a
  let compose = f -> g -> a -> f(g(a))
}

Imports

module Test.Id {
  import Test.Func
  let app = id(1)
}

module Test.Compose {
  import Test.Func.{ compose, id }
  let pointless = compose(id)(id)(1)
}

Continuous Benchmarks

This project has a small benchmark suite which runs against every commit.

It consists of a collection of source files whose compilation time is benchmarked using the command-line benchmark utility hyperfine.

The results are charted here.

inc's People

Contributors

davidgregory084 avatar

Watchers

James Cloos 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.