-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCodeGenerator.h
55 lines (48 loc) · 1.07 KB
/
CodeGenerator.h
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
// Authors: Ivan Lim, Brooke Borges, Chad Lewis
// Class: CS 460, Programming Languages
// Assignment: Project 3
// File: CodeGenerator.h
// Date: Spring 2017
#ifndef CG_H
#define CG_H
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include "Object.h"
class CodeGenerator {
public:
CodeGenerator( char * );
~CodeGenerator();
void defineMain();
void defineFunction( string );
void endFunction();
void returnIdentifier( string );
void returnCreatedObject( string );
void writeCode( string );
void callFunction( string );
void callListOp( string );
void addParameter( string );
void endParameters();
void makeObject_begin();
void makeObject_end();
void addToListStack( string );
void endList();
void if_beginCondition();
void if_endCondition();
void else_begin();
void endControlStructure();
void newline();
void addIndent();
void minusIndent();
void indentCode();
void displayOutput();
private:
ofstream cppFile;
vector<string> params;
vector<string> listStack;
bool isMain;
int numTabsIndented;
void writeIncludes();
};
#endif