MCPcopy Create free account
hub / github.com/acsoto/BUAA-Compiler / PCodeExecutor

Method PCodeExecutor

src/CodeGeneration/PCodeExecutor.java:24–43  ·  view source on GitHub ↗
(ArrayList<PCode> codes, FileWriter writer, Scanner scanner)

Source from the content-addressed store, hash-verified

22 private Scanner scanner;
23
24 public PCodeExecutor(ArrayList<PCode> codes, FileWriter writer, Scanner scanner) {
25 this.codes = codes;
26 this.writer = writer;
27 this.scanner = scanner;
28 for (int i = 0; i < codes.size(); i++) {
29 PCode code = codes.get(i);
30 // get main function address
31 if (code.getType().equals(CodeType.MAIN)) {
32 mainAddress = i;
33 }
34 // get all label
35 if (code.getType().equals(CodeType.LABEL)) {
36 labelTable.put((String) code.getValue1(), i);
37 }
38 //get all function
39 if (code.getType().equals(CodeType.FUNC)) {
40 funcTable.put((String) code.getValue1(), new Func(i, (int) code.getValue2()));
41 }
42 }
43 }
44
45 private void push(int i) {
46 stack.add(i);

Callers

nothing calls this directly

Calls 3

getTypeMethod · 0.95
getValue1Method · 0.95
getValue2Method · 0.95

Tested by

no test coverage detected