-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput.cpp
35 lines (27 loc) · 1.02 KB
/
output.cpp
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
#include <iostream>
#include "output.hpp"
using namespace std;
void output::endScope(){
cout << "-- end scope --" << endl;
}
void output::printVar(const char* id, int offset, const char* type ){
cout << "var:" << id << ":" << offset << ":" << type << endl;
}
void output::errorLex(int lineno){
cout << "line " << lineno << ":" << " lexical error" << endl;
}
void output::errorSyn(int lineno){
cout << "line " << lineno << ":" << " syntax error" << endl;
}
void output::errorUndef(int lineno, const char* id){
cout << "line " << lineno << ":" << " variable " << id << " is not defined" << endl;
}
void output::errorDef(int lineno, const char* id){
cout << "line " << lineno << ":" << " variable " << id << " is already defined" << endl;
}
void output::errorMismatch(int lineno){
cout << "line " << lineno << ":" << " type mismatch" << endl;
}
void output::errorUnexpectedBreak(int lineno) {
cout << "line " << lineno << ":" << " unexpected break statement" << endl;
}