Skip to content

Commit bcbf957

Browse files
committed
new file
1 parent b1a059d commit bcbf957

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

compiler.py

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import ast
2+
from ast import *
3+
from utils import *
4+
from x86_ast import *
5+
import os
6+
from typing import List, Tuple, Set, Dict
7+
8+
Binding = Tuple[Name, expr]
9+
Temporaries = List[Binding]
10+
11+
12+
class Compiler:
13+
14+
############################################################################
15+
# Remove Complex Operands
16+
############################################################################
17+
18+
def rco_exp(self, e: expr, need_atomic: bool) -> Tuple[expr, Temporaries]:
19+
# YOUR CODE HERE
20+
pass
21+
22+
def rco_stmt(self, s: stmt) -> List[stmt]:
23+
# YOUR CODE HERE
24+
pass
25+
26+
27+
def remove_complex_operands(self, p: Module) -> Module:
28+
# YOUR CODE HERE
29+
pass
30+
31+
32+
############################################################################
33+
# Select Instructions
34+
############################################################################
35+
36+
def select_arg(self, e: expr) -> arg:
37+
# YOUR CODE HERE
38+
pass
39+
40+
def select_stmt(self, s: stmt) -> List[instr]:
41+
# YOUR CODE HERE
42+
pass
43+
44+
def select_instructions(self, p: Module) -> X86Program:
45+
# YOUR CODE HERE
46+
pass
47+
48+
############################################################################
49+
# Assign Homes
50+
############################################################################
51+
52+
def assign_homes_arg(self, a: arg, home: Dict[Variable, arg]) -> arg:
53+
# YOUR CODE HERE
54+
pass
55+
56+
def assign_homes_instr(self, i: instr,
57+
home: Dict[location, arg]) -> instr:
58+
# YOUR CODE HERE
59+
pass
60+
61+
def assign_homes_instrs(self, ss: List[instr],
62+
home: Dict[location, arg]) -> List[instr]:
63+
# YOUR CODE HERE
64+
pass
65+
66+
def assign_homes(self, p: X86Program) -> X86Program:
67+
# YOUR CODE HERE
68+
pass
69+
70+
############################################################################
71+
# Patch Instructions
72+
############################################################################
73+
74+
def patch_instr(self, i: instr) -> List[instr]:
75+
# YOUR CODE HERE
76+
pass
77+
78+
def patch_instrs(self, ss: List[instr]) -> List[instr]:
79+
# YOUR CODE HERE
80+
pass
81+
82+
def patch_instructions(self, p: X86Program) -> X86Program:
83+
# YOUR CODE HERE
84+
pass
85+
86+
############################################################################
87+
# Generate Main Function
88+
############################################################################
89+
90+
def generate_main(self, p: X86Program) -> X86Program:
91+
# YOUR CODE HERE
92+
pass
93+
94+
############################################################################
95+
# Print x86
96+
############################################################################
97+
98+
def print_x86(self, p: X86Program) -> str:
99+
# YOUR CODE HERE
100+
pass
101+
102+
def print_instr(self, i: instr) -> str:
103+
# YOUR CODE HERE
104+
pass
105+
106+
def print_arg(self, a: arg) -> str:
107+
# YOUR CODE HERE
108+
pass

0 commit comments

Comments
 (0)