Hi! In this repository you’ll find the final assignment of INF01147: a
compiler implemented in the C language using flex
, bison
and other
friends.
The project will span through the following stages:
Stage | Description |
---|---|
E1 | Lexical Analysis |
E2 | Syntax Analysis |
E3 | Abstract Syntax Tree |
E4 | Semantic Analysis |
E5 | Code Generation |
E6 | Execution Support |
E7 | Optimization |
At the end of each stage, we will update the repository with a tag containing the stage code. This way you can track the release schedule through this semester.
We’ve structured the template according to the following directories:
- src/
- The sources directory. Here lies all
.c
files, organized inside this folder in sub-folders if the source-code belongs to a module or namespace. If the file rests in the root of this directory its considered amain
file, which will be compiled as one of the target executables. - include/
- The headers directory, analogue to the sources directory.
- bin/
- The
.o
directory. Here will be dumped all compiled objects. - build/
- The executables directory. Here is the final resting place of the project targets.
- scripts/
- The
.sh
directory. Any script that needs to be used during the compiling or dependency handling or whatever should stay here.
To build, just run this single line in the root of this repository:
make
This is the case as the default target for my Makefile
is the all
rule.
To use all cores in your machine, just add the following flag:
make -j<NUMBER_OF_CORES>
# like
make -j4
In order to find out how many cores you have, run any of the following command in your shell:
# either
nproc
# or
lscpu
# or
cat /proc/cpuinfo
Also, here’s an example of all the rules you can target (and, therefore, call this Makefile with):
ccompiler's project Makefile. Utilization example: make <TARGET> ['DEBUG=true'] @param TARGET Can be any of the following: all - builds the project (DEFAULT TARGET) clean - cleans up all binaries generated during compilation redo - cleans up and then builds help - shows the utilization example test - builds and run tests tool - generates compile_commands.json release - cleans and compresses the work directory for release @param 'DEBUG=true' When present, the build will happen in debug mode.
You can contact me through the following e-mail address:
hcpsilva@inf.ufrgs.br