source: liacs/coco/assignment4/IntermediateCode.h@ 144

Last change on this file since 144 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 1.3 KB
Line 
1/*
2 * IntermediateCode.h - Declaration of the IntermediateCode abstract data structure
3 *
4 * Part of the assignment of the Compiler Construction course
5 * LIACS, Leiden University
6 *
7 * Note that deleting an IntermediateCode object will also delete all
8 * IStatement objects associated to it.
9 */
10
11#ifndef _INTERMEDIATECODE_H_
12#define _INTERMEDIATECODE_H_
13
14#include <cstdio>
15#include <vector>
16#include "IStatement.h"
17
18
19using namespace std;
20
21// This class stores a linear list of intermediate statements and provides
22// operations to modify that list.
23class IntermediateCode {
24 public:
25 // Constructor/destructor
26 IntermediateCode();
27 ~IntermediateCode();
28
29 // Gets the program name
30 string GetProgramName();
31
32 // Sets the program name
33 void SetProgramName(string name);
34
35 // Returns the number of statements
36 unsigned int GetStatementCount();
37
38 // Gets the i-th statement
39 IStatement *GetStatement(unsigned int i);
40
41 // Appends a statement
42 void AppendStatement(IStatement *stmt);
43
44 // Inserts a statement before the i-th statement
45 void InsertStatement(IStatement *stmt, unsigned int i);
46
47 // Removes the i-th statement
48 void RemoveStatement(unsigned int i);
49
50 // Dump
51 void Dump(FILE *file);
52
53 private:
54 string programName;
55 vector<IStatement*> statements;
56};
57
58#endif
Note: See TracBrowser for help on using the repository browser.