C_compiler_for_MCPU_info4_2021_2022.md 1.92 KB
Newer Older
Eve Poitevin's avatar
Eve Poitevin committed
1
2
# Journal

Eve Poitevin's avatar
Eve Poitevin committed
3
## January the 17th
Eve Poitevin's avatar
Eve Poitevin committed
4

Julian Royet's avatar
Julian Royet committed
5
6
Today was mostly about understanding the topic.

Julian Royet's avatar
Julian Royet committed
7
8
9
We made an attempt to decypher the obfuscated code, and deemed it too long and complicated to be worth the time.
We then investigated different SmallC compilers, most of which were big projects, beyond the scope of ours. 
However we did find a short parser written in OCaml, which could be a useful inspiration.
Julian Royet's avatar
Julian Royet committed
10

Julian Royet's avatar
Julian Royet committed
11
Figured out the MCPU architecture.
Julian Royet's avatar
Julian Royet committed
12

Julian Royet's avatar
Julian Royet committed
13
Read and understood the asm.py file.
Julian Royet's avatar
Julian Royet committed
14

Julian Royet's avatar
Julian Royet committed
15
Started thinking about the implementation of a parser and compiler.
Eve Poitevin's avatar
Eve Poitevin committed
16

Julian Royet's avatar
Julian Royet committed
17
18
Goal : 
Making a SmallC compiler written in SmallC
Eve Poitevin's avatar
Eve Poitevin committed
19

Julian Royet's avatar
Julian Royet committed
20
21
22
23
24
Challenge:
The more simplified our implementation of SmallC, the less there is to program, but programming becomes harder because of the limited features. We need to balance the number of features and the code complexity depending on them.

To do :
Read & understand emu.py.
25
26
27

## January the 24th

Julian Royet's avatar
Julian Royet committed
28
29
30
31
First draft of the SmallC grammar
We decided not to have any variable types, pointers, or stack. All the variables are global.

Writing the first lines of the parser
32
33
34

## January the 31st

Julian Royet's avatar
Julian Royet committed
35
36
37
38
39
40
41
Writing the first macros (writing low level asm programs to build high level programming blocks like loops, ifs, multiplications, etc).

Still working on the parser.

## February the 7th

Still working on the parser.
Julian Royet's avatar
Julian Royet committed
42

Julian Royet's avatar
Julian Royet committed
43
44
Still working on the macros.

Eve Poitevin's avatar
Eve Poitevin committed
45
46
Definition of grammar.

Julian Royet's avatar
Julian Royet committed
47
48
49
## February the 14th

Still working on the parser.
Julian Royet's avatar
Julian Royet committed
50

Eve Poitevin's avatar
Eve Poitevin committed
51
52
53
54
Still working on the macros.

Call with M. Richard.

55
56
Simple tests on macros with emu.py.

Eve Poitevin's avatar
Eve Poitevin committed
57
58
59
60
61
62
63
64
65
## February the 28th

Mid-term presentation.

## March the 7th

We have made good progress on programming the lexer.
We've discussed token types, organizing what we'll read, and how to implement it.

66
67
## March the 14th

Eve Poitevin's avatar
Eve Poitevin committed
68
We continued to implement the lexer.
69
70

Most simple macros work in tests.
Eve Poitevin's avatar
Eve Poitevin committed
71
72
73
74
75
76
77
78
79
80

## March the 28th

We finished to implement the lexer.

We did a test on a C file and we manage to lex this file correctly.

Now the goal is to implement the parser and make some AST.