Last change
on this file since 157 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
|
Rev | Line | |
---|
[2] | 1 | /*
|
---|
| 2 | * IStatement.h - Declaration of the IStatement abstract data structure
|
---|
| 3 | *
|
---|
| 4 | * Part of the assignment of the Compiler Construction course
|
---|
| 5 | * LIACS, Leiden University
|
---|
| 6 | *
|
---|
| 7 | * Note that deleting an IStatement object will also delete the IOperand
|
---|
| 8 | * objects associated to it.
|
---|
| 9 | */
|
---|
| 10 |
|
---|
| 11 | #ifndef _ISTATEMENT_H_
|
---|
| 12 | #define _ISTATEMENT_H_
|
---|
| 13 |
|
---|
| 14 | #include <cstdio>
|
---|
| 15 | #include "IOperator.h"
|
---|
| 16 | #include "IOperand.h"
|
---|
| 17 |
|
---|
| 18 | // A statement in the intermediate code (quadruple)
|
---|
| 19 | class IStatement {
|
---|
| 20 | public:
|
---|
| 21 | // Constructors/destructor
|
---|
| 22 | IStatement();
|
---|
| 23 | IStatement(IOperator op);
|
---|
| 24 | IStatement(IOperator op, IOperand *opnd1, IOperand *opnd2, IOperand *res);
|
---|
| 25 | ~IStatement();
|
---|
| 26 |
|
---|
| 27 | // Get operator
|
---|
| 28 | IOperator GetOperator();
|
---|
| 29 |
|
---|
| 30 | // Set operator
|
---|
| 31 | void SetOperator(IOperator op);
|
---|
| 32 |
|
---|
| 33 | // Get operand 1
|
---|
| 34 | IOperand *GetOperand1();
|
---|
| 35 |
|
---|
| 36 | // Set operand 1
|
---|
| 37 | void SetOperand1(IOperand *operand);
|
---|
| 38 |
|
---|
| 39 | // Get operand 2
|
---|
| 40 | IOperand *GetOperand2();
|
---|
| 41 |
|
---|
| 42 | // Set operand 2
|
---|
| 43 | void SetOperand2(IOperand *operand);
|
---|
| 44 |
|
---|
| 45 | // Get result operand
|
---|
| 46 | IOperand *GetResult();
|
---|
| 47 |
|
---|
| 48 | // Set result operand
|
---|
| 49 | void SetResult(IOperand *operand);
|
---|
| 50 |
|
---|
| 51 | // Dump
|
---|
| 52 | void Dump(FILE *file, int indent);
|
---|
| 53 |
|
---|
| 54 | private:
|
---|
| 55 | IOperator ioperator;
|
---|
| 56 | IOperand *operand1;
|
---|
| 57 | IOperand *operand2;
|
---|
| 58 | IOperand *result;
|
---|
| 59 | };
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.