Skip to content
Snippets Groups Projects
README.md 1.57 KiB
Newer Older
User expired's avatar
User expired committed
# mC Compiler

User expired's avatar
User expired committed
This repository holds a *getting started* code-base for the [compiler construction course](https://git.uibk.ac.at/c7031162/703602-Compiler-Construction).
User expired's avatar
User expired committed

Be sure to understand the provided code before using it!

- See [Development Notes](docs/development_notes.md)

## Prerequisites

- [Meson](http://mesonbuild.com/) in a recent version (`0.44.0`)
  (you may want to install it via `pip3 install --user meson`)
- [Ninja](https://ninja-build.org/)
- `time`, typically located at `/usr/bin/time`, do not confuse this with the Bash built-in
- `flex` for generating the lexer
- `bison` for generating the parser
- A compiler supporting C11 — typically GCC or Clang

## Build Instructions

First, generate the build directory.

    meson builddir
    cd builddir
User expired's avatar
User expired committed

Meson creates Ninja build files.
Let's build.

User expired's avatar
User expired committed

Unit tests can be run directly with Ninja (or Meson).

User expired's avatar
User expired committed

For integration testing we try to compile mC programs and compare their output for a given input.

    ../scripts/run_integration_tests
User expired's avatar
User expired committed

Taken from the [Meson Documentation](https://mesonbuild.com/Unit-tests.html#coverage):

> If you enable coverage measurements by giving Meson the command line flag `-Db_coverage=true`, you can generate coverage reports.
> Meson will autodetect what coverage generator tools you have installed and will generate the corresponding targets.
> These targets are `coverage-xml` and `coverage-text` which are both provided by Gcovr and `coverage-html`, which requires Lcov and GenHTML or Gcovr with html support.

## Known Issues

- Parser leaks memory on invalid inputs.