{"id":15680975,"url":"https://github.com/davidgregory084/inc","last_synced_at":"2025-05-07T11:41:06.367Z","repository":{"id":36252598,"uuid":"136540312","full_name":"DavidGregory084/inc","owner":"DavidGregory084","description":"Experiments with incremental compiler construction on the JVM","archived":false,"fork":false,"pushed_at":"2022-03-15T18:36:36.000Z","size":59037,"stargazers_count":11,"open_issues_count":6,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-26T00:31:43.511Z","etag":null,"topics":["compiler","compiler-construction","functional-programming","jvm","jvm-languages"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DavidGregory084.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-07T23:05:28.000Z","updated_at":"2022-10-31T14:10:39.000Z","dependencies_parsed_at":"2022-08-08T13:47:19.103Z","dependency_job_id":null,"html_url":"https://github.com/DavidGregory084/inc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidGregory084%2Finc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidGregory084%2Finc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidGregory084%2Finc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidGregory084%2Finc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DavidGregory084","download_url":"https://codeload.github.com/DavidGregory084/inc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242956129,"owners_count":20212449,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","compiler-construction","functional-programming","jvm","jvm-languages"],"created_at":"2024-10-03T16:47:50.536Z","updated_at":"2025-03-11T01:32:33.867Z","avatar_url":"https://github.com/DavidGregory084.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# inc\n\n[![Build Status](https://api.travis-ci.org/DavidGregory084/inc.svg)](https://travis-ci.org/DavidGregory084/inc)\n[![License](https://img.shields.io/github/license/DavidGregory084/inc.svg)](https://opensource.org/licenses/Apache-2.0)\n\nExperiments with [An Incremental Approach to Compiler Construction](http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf) on the JVM.\n\n## Disclaimer\n\nThis is a hobby project. Expect lots of bugs and don't expect to be able to use this for anything useful.\n\n## Getting started\n\nThis project is built with [mill](https://www.lihaoyi.com/mill/) version 0.8.0 and requires Java 8 or above to be installed.\n\nTo build the project:\n\n```scala\nmill _.compile\n```\n\nTo run the test suite:\n\n```scala\nmill _.test\n```\n\nTo build an executable at the root of the repo:\n\n```scala\nmill main.generateRunScript\n```\n\nYou should be able to use this executable to compile your own programs.\n\nSee the help text for details of the command line interface:\n\n```\n$ ./inc --help\ninc 0.1.0-SNAPSHOT\nUsage: inc [options] \u003cfile\u003e\n\n  --help\n  --version\n  -cp, --classpath \u003cvalue\u003e\n                           The classpath to use when compiling. Defaults to the current directory.\n  -d, --destination \u003cvalue\u003e\n                           The destination directory for compilation output. Defaults to the current directory.\n  --print-parser           Print syntax trees after the parsing phase\n  --print-resolver         Print syntax trees after the name resolution phase\n  --print-typer            Print syntax trees after the type inference phase\n  --print-codegen          Print the java bytecode generated by the code generation phase\n  --print-timings          Print the time taken in each phase\n  --verify-codegen         Run a verifier on the code produced in codegen\n  --exit-on-error \u003cvalue\u003e  Exit the Java VM with exit code 1 if an error occurs\n  --stop-before \u003cvalue\u003e    Stop before the named phase. Currently defined phases: parser, resolver, typer, codegen\n  \u003cfile\u003e                   The source file to compile\n```\n\n## Language features\n\n### Modules\n\n```scala\nmodule Test {}\n```\n\n### Let bindings and literals\n\n```scala\nmodule Test/Let {\n  let litInt = 42\n  let litLong = 42L\n  let litFloat = 42.0F\n  let litDouble = 42.0D\n  let litBool = true\n  let litChar = 'a'\n  let litString = \"foo\"\n  let litUnit = ()\n}\n```\n\n### If expressions\n\n```scala\nmodule Test/If {\n  let choose = if true then 1 else 0\n}\n```\n\n### Functions\n\n```scala\nmodule Test/Func {\n  let id = a -\u003e a\n  let compose = f -\u003e g -\u003e a -\u003e f(g(a))\n}\n```\n\n### Imports\n\n```scala\nmodule Test/Id {\n  import Test/Func\n  // Imports are qualified by default\n  let app = Func.id(1)\n}\n\nmodule Test/Compose {\n  import Test/Func.{ compose, id }\n  // Individual symbols can be imported unqualified\n  let pointless = compose(id)(id)(1)\n}\n```\n\n### Data declarations\n\n```scala\nmodule Test/Data {\n  data Either[A, B] {\n    case Left(a: A)\n    case Right(b: B)\n  }\n\n  data Fix[F] {\n    case Unfix(unfix: F[Fix[F]])\n  }\n}\n```\n\n### Pattern matching\n\n```scala\nmodule Test/Data {\n  data Option[A] {\n    case Some(a: A)\n    case None()\n  }\n\n  data List[A] {\n    case Cons(head: A, tail: List[A])\n    case Nil()\n  }\n\n  let last = list -\u003e match list with {\n    case Cons { head, tail: Nil {} } -\u003e Some(head)\n    case Cons { tail } -\u003e last(tail)\n    case Nil {} -\u003e None()\n  }\n}\n```\n\n## Structure of the project\n\nThe dependency structure of the modules is described in the following diagram:\n\n![Dependency structure diagram](./architecture/structurizr-Structure.png)\n\nThe relationship of the modules during compilation is as follows:\n\n![Diagram of compilation](./architecture/structurizr-Compilation.png)\n\n## Continuous Benchmarks\n\n~~This project has a small benchmark suite which runs against every commit.~~\n\n~~It consists of a collection of source files whose compilation time is benchmarked using the command-line benchmark utility [hyperfine](https://github.com/sharkdp/hyperfine).~~\n\n~~The results are charted [here](http://ec2-3-8-136-202.eu-west-2.compute.amazonaws.com:3000/d/v0rJ3CvZk/benchmark-results?orgId=1\u0026refresh=1m).~~\n\nBare metal benchmarking agents are too expensive for the moment!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidgregory084%2Finc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidgregory084%2Finc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidgregory084%2Finc/lists"}