# MiniC interpreter and typer
LAB3, MIF08 / CAP 2022-23


# Authors

Samy Avrillon
Mostly you for the 

# Contents

Well ... You did the code infrastructure, so i have no interest in telling that it is bad. So ... Great infrastructure !

I think this part is for future work on MiniC, so i will not answer it (seriously).

# Howto

`make test-interpret TEST_FILES='TP03/tests/provided/examples/test_print_int.c'` for a single run

`make test` to test all the files in `*/tests/*` according to `EXPECTED` results.

You can select the files you want to test by using `make test TEST_FILES='TP03/**/*bad*.c'` (`**` means
"any number of possibly nested directories").

# Test design 

- «corrected» folder corresponds to the tests that i have changed from the base set (see Desing Choices below)
- «typeErrors» folder corresponds to tests of the error messages when using an operator/structure. Each *part* of the operator/structure is checked independently so we know for sure where the error comes from.
- ifClauseSyntax and whileClauseSyntax test the syntax of if and while clauses.
- floatDiv0, floatMod0, intDiv0 et intMod0 tests «Division by 0» errors.
- multidecl.c test multi-variables declarations.
- testOps.c test float and int arithmetics.
- forTests.c tests the execution of the for (C-like) loops.

# Design choices

We will consider that when using an operator on two types with one of them illegal (for example, trying to multiply an int and a string), an error of type «type mismatch» will be raised instead of an «invalid type» one. This allows to check type equality before type validity.

The protocol to choosing an error message is as follows:
- If the operator requires its arguments to be of the same type, the first check is equality of the types of the operands. In case of error, an error of type «type mismatch» is raised with the types of the operands.
- If this check passed, the first argument type is checked, and if it is invalid, an error of type «invalid type» is raised **with only one type**
- If the operator can take arguments of different types, each type is checked, and in case of error, an error of type «invalid type» is raised with **type for each argument**.

In order to follow this protocol, two tests have been rewritten (and moved to the «student» directory): bad_type01.c and bad_type_bool_bool.c

# Known bugs

I think i did everything i was asked, and did not notice any bug.
