-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtodo.txt
66 lines (45 loc) · 1.87 KB
/
todo.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
2023/10/14 TS:
Must keep clear in mind what to do in Enter and what to do in Exit!
Do not mix them up!
For Decl, we can have several utility functions:
1. Count how many child node of a given type, for dimension.
2. Array serialization, for init value.
3. Only add to symbol table in Exit!
And, we may need some utility function that could generate unique name
for duplicated name.
____________________________________________________________
2023/10/15 TS:
For the type of expression, we can get it at ExitExp, then let its parent
decide whether the type is correct or not.
However, internal type mismatch, i.e. ARRAY + INT will be reported within
Exp, and the type of it will be "repaired" as INT.
For array, its type will directly be received by LVal, then pulled up to
Exp. (Actually, we can let it be in LVal, and later get it via Synthesized
Attribute.) When we get type of LVal, we can ignore whether the variable
is declared or not, and treat it all as INT. However, it indeed needs to be
checked, only generate other errors.
In Exp, every time there is a join, we need to check whether the type is
correct or not. And pull the type up to here. If type mismatch happens,
we need to report error, and repair the type as INT.
Well, a step further, we pull the type in each exp node! So that we can
directly get it, without the worries that the exp has an invalid type.
2023/10/16 TS:
Make syntactic parser recover from errors.
2023/10/17 TS:
BUG: getint() didn't report missing ) and ;
-----
2023/10/31 TS:
Task for intermediate representation generation:
Step 1.
* 1. For simple variable and constant declaration.
* 2. For expression.
* 3. For assignment.
Step 2.
* 1. For function definition.
* 2. For function call.
Step 3.
1. For for loop.
2. For if-else statement.
Step 4.
1. Introduce array.
g++ -o a.out $(find . -type f -iname *.cpp -print)