Building from Source

This guide will walk you through the process of building the Frost compiler from source. Building from source allows you to work with the latest development version and contribute to the project.

Prerequisites

Before you begin, ensure you have the following tools installed:

  1. GHC 9.4.8: The Glasgow Haskell Compiler version 9.4.8

  2. Cabal: The latest version of the Cabal build system

  3. Git: For cloning the repository and managing submodules

  4. LLVM 19+: The LLVM compiler infrastructure, version 19 or newer

  5. Make: The GNU Make build automation tool

Step-by-Step Instructions

  1. Clone the Repository

    Clone the Frost repository and initialize its submodules:

    git clone --recursive https://github.com/Jabolol/frost.git
    cd frost
  2. Set Up GHC and Cabal

    Ensure you're using GHC 9.4.8. If you have GHCup installed, you can run:

    ghcup install ghc 9.4.8
    ghcup set ghc 9.4.8
  3. Install Dependencies

    Install the project dependencies using Cabal:

    cabal update
    cabal install --only-dependencies
  4. Build the Compiler

    From the root directory of the project, run:

    make

    This command will compile the Frost compiler and generate the frostc executable in the project root.

  5. Verify the Installation

    To ensure the compiler was built successfully, run:

    ./frostc -h

    This should display the version information for the Frost compiler.

Documentation

We maintain Haddock documentation for the Frost compiler. It is currently hosted on GitHub Pages and can be accessed at https://jabolol.github.io/frost/.

To generate the documentation locally, run the following command:

cabal haddock

Troubleshooting

  • If you encounter LLVM-related errors, make sure you have LLVM 19 or newer installed and that it's in your system PATH.

  • For any Haskell package dependency issues, try running cabal update before attempting the build process again.

Contributing

After successfully building Frost from source, you're ready to start contributing to the project. Be sure to read our contribution guidelines and coding standards before submitting any pull requests.

Remember to keep your local copy of the repository up to date by regularly pulling changes and updating submodules:

git pull
git submodule update --init --recursive

By building Frost from source, you're not only getting the latest features but also positioning yourself to contribute to the language's development. Happy coding!

Pre-Commit Hooks

This repository uses pre-commit hooks to ensure code quality. To install the hooks, run the following command:

pre-commit install

Hooks for code formatting and linting will run automatically when you commit changes. These hooks are ormolu and hlint. Please make sure to fix any errors before committing. You can also run the hooks manually using:

pre-commit run --all-files

Devcontainer

This project includes a devcontainer configuration for Visual Studio Code. To use the devcontainer, you need to have Docker, Visual Studio Code and the Remote - Containers extension installed.

To open the project in the devcontainer, open the command palette (Ctrl+Shift+P) and run the command Remote-Containers: Reopen in Container. All the necessary tools and dependencies will be installed in the container.

Development Workflow

When working on the Frost compiler, you can use the following commands to build the project:

cabal build

To run the project, run the following command, replacing examples/hello.ff with the path to your Frost source file:

cabal run frostc -- -i examples/hello.ff

Last updated