time, typically located at/usr/bin/timeflexfor generating the lexerbisonfor generating the parsergccmesonbuild-essentialcmakegcc-multilibpkg-configgitgoogle testfor running the unit tests (included build script requires cmake)doxygenfor generating the documentation (already generated under /doc)gcovr & lcovfor generating the coverage reports
Two scripts are provided which can be used to build and start the a docker container. This container has already all necessary dependencies preinstalled:
./buildDocker.shBuild the docker container which should be used for testing and compiling../startDocker.shWhich spins up the docker container in interactive mode.
First, generate the build directory.
$ meson builddir
$ cd builddir
Meson creates Ninja build files. Let's build.
$ ninja
Unit tests can be started with:
$ ninja test
cd scripts(from project root)./run_IntegrationTests.sh(make sure you have exec permissions)
This command will genereate the documentation and save it under /doc/doc
doxygen doxygen.config (from project root)
meson builddir -Db_coverage=true(from project root)cd builddirninja testninja coverage
The following directory layout is used.
mcc/
├── app/ # Each C file in this directory corresponds to one executable.
│ ├── mc_ast_to_dot.c
│ ├── mcc.c
│ └── …
├── docs/ # Additional documentation goes here.
│ └── …
├── include/ # All public headers live here, note the `mcc` subdirectory.
│ └── mcc/
│ ├── ast.h
│ ├── ast_print.h
│ ├── ast_visit.h
│ ├── parser.h
│ └── …
├── src/ # The actual implementation; may also contain private headers and so on.
│ ├── ast.c
│ ├── ast_print.c
│ ├── ast_visit.c
│ ├── parser.y
│ ├── scanner.l
│ └── …
├── test/
│ ├── integration/ # Example inputs for integration testing.
│ │ ├── fib/
│ │ │ ├── fib.mc
│ │ │ ├── fib.stdin.txt
│ │ │ └── fib.stdout.txt
│ │ └── …
│ └── unit/ # Unit tests, typically one file per unit.
│ ├── parser_test.c
│ └── …
├── subprojects/ # Subprojects used for meson
└── README.md
- Currently the builddir must be called
builddirbecause with have a strong reference (#include "../builddir/mcc@sha/parser.tab.hh") to from the parser generated file. (Seeinclude/mcDriver/mcDriver.cpp)