Skip to content

btq-ag/keelung-compiler

Repository files navigation

The Keelung Compiler

Documentation on how to hack it is on the way. Feel free to open issues or make PRs!

For Users

Installation

See the Installation Guide on Gitbook.

Release Notes

Visit the Releases page to see all the releases and their changelogs, note that old releases before v0.12.1 are in the release page of btq-ag/keelung repo instead.

For Developers

Install

After cloning the repository, run the following command in the root of the repository to build the project:

stack build

Stack is the recommended build tool for Keelung, which can be installed via GHCup.

How to dockerize keelungc

To dockerize the executable keelungc, run the following command in the root of the repository:

DOCKER_BUILDKIT=1  docker build --ssh default -t keelung -f Dockerfile .

(add --platform linux/amd64 if you are using architectures like arm64)

The built image is currently available on the Docker Hub as banacorn/keelung.

To execute the image, run:

docker run banacorn/keelung

(add --platform linux/amd64 if you are using architectures like arm64)

How to profile the compiler and generate flamegraphs

  1. Install ghc-prof-flamegraph on your machine:
stack install ghc-prof-flamegraph
  1. Prepare an executable like profile in profiling/Main.hs with the program you want to profile.
  2. Build and install the executable with profiling enabled:
stack install keelung-compiler:exe:profile --profile
  1. Generate a profiling report:
stack exec --profile -- profile +RTS -p
  1. Generate a flamegraph:
ghc-prof-flamegraph profile.prof

Notes for Releasing Binaries

Binaries released to the Keelung repo includes automatically generated licenses using cabal-plan, for Github Actions to work, keelung dependency in cabal.project must be updated to match its commit hash used in stack.yaml for the CI to build. This is only required when a major release is needed.