Skip to content

Commit

Permalink
更新俩文件
Browse files Browse the repository at this point in the history
  • Loading branch information
zbspyZJF committed Dec 10, 2018
1 parent 5b2d8ad commit 42270e7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
22 changes: 20 additions & 2 deletions IntermediateCodeGenerate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// Created by IceCapriccio on 2018/12/3.
//

#include <iostream>
#include "IntermediateCodeGenerate.h"
#include "SyntaxAnalyse.h"

SymbolTable SyntaxAnalyse::symbolTable;
SupportTable supportTable;
Expand All @@ -16,6 +14,26 @@ CodeTerm::CodeTerm(Type op, int param1, int param2, int dest)
: op(op), param1(param1), param2(param2), dest(dest) {
}

Type CodeTerm::getOp()
{
return op;
}

int CodeTerm::getParam1()
{
return param1;
}

int CodeTerm::getParam2()
{
return param2;
}

int CodeTerm::getDest()
{
return dest;
}

void CodeTerm::show() {
int idx = op;
cout << '(' << name[idx] << ',' << param1 << ',' << param2 << ',' << dest << ')' << endl;
Expand Down
6 changes: 6 additions & 0 deletions IntermediateCodeGenerate.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef COMPILER_INTERMEDITECODEGENERATE_H
#define COMPILER_INTERMEDITECODEGENERATE_H

#include <iostream>
#include "SyntaxAnalyse.h"
#include <map>
#include "SemanticAnalyse.h"

Expand All @@ -15,6 +17,10 @@ class CodeTerm {
public:
Type type;
CodeTerm(Type op, int param1, int param2, int dest);
Type getOp();
int getParam1();
int getParam2();
int getDest();
void show();
};

Expand Down
4 changes: 4 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Created by zjf on 2018/12/9.
//

0 comments on commit 42270e7

Please sign in to comment.