Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tddd55-lab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TDDD55 - Compilers and Interpreters
tddd55-lab
Commits
d931ec78
Commit
d931ec78
authored
4 years ago
by
John Tinnerholm
Browse files
Options
Downloads
Patches
Plain Diff
Delete function.hh
This file is not used
parent
0233a18f
No related branches found
No related tags found
1 merge request
!2
Delete function.hh
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lab3-4/function.hh
+0
-114
0 additions, 114 deletions
lab3-4/function.hh
with
0 additions
and
114 deletions
lab3-4/function.hh
deleted
100644 → 0
+
0
−
114
View file @
0233a18f
#ifndef __KOMP_FUNCTION__
#define __KOMP_FUNCTION__
/*
* SymbolInformationType is used to tag object subclassed from
* SymbolInformation. The value of SymbolInformation's type field
* specified which subclass the object belongs to.
*/
typedef
enum
{
kFunctionInformation
,
kVariableInformation
,
kTypeInformation
,
}
SymbolInformationType
;
/*
* SymbolInformation is the base class for all information about
* symbols. It is never used directly; use the subclasses instead
*/
class
SymbolInformation
{
public:
SymbolInformationType
type
;
string
id
;
SymbolTable
*
table
;
SymbolInformation
(
SymbolInformationType
t
)
:
type
(
t
)
{};
};
/*
* FunctionInformation represents information stored about a function
* in the symbol table. It contains the return type of the function, a
* pointer to the functions's first parameter and a pointer to the
* symbol table for the function.
*/
class
FunctionInformation
:
SymbolInformation
{
public:
TypeInformation
*
returnType
;
VariableInformation
*
firstParam
;
SymbolTable
*
symbolTable
;
FunctionInformation
()
:
SymbolInformationType
(
kFunctionInformation
)
{};
void
SetParent
(
FunctionInformation
*
);
void
SetReturnType
(
TypeInformation
*
);
void
SetName
(
string
&
);
char
AddParameter
(
string
&
,
TypeInformation
*
);
char
AddVariable
(
string
&
,
TypeInformation
*
);
char
AddArrayType
(
TypeInformation
*
,
int
);
};
/*
* VariableInformation represents information stored about a variable
* in the symbol table. It contains a type field which specifies
* the type of the variable and a next field which is used to link
* together parameters and local variables in a symbol table.
*/
class
VariableInformation
:
SymbolInformation
{
public:
TypeInformation
*
type
;
VariableInformation
*
next
;
VariableInformation
()
:
SymbolInformation
(
kVariableInformation
)
{};
};
class
TypeInformation
:
SymbolInformation
{
public:
TypeInformation
*
elementType
;
int
arrayDimensions
;
TypeInformation
()
:
SymbolInformation
(
kTypeInformation
)
{};
}
/*
* SymbolTable is a symbol table. You'll never really use this
* directly. Instead, use the methods in the FunctionInformation
* class for adding and looking up variables in the symbol table
*/
class
SymbolTableElement
{
public:
SymbolInformation
*
info
;
SymbolTableElement
*
next
;
};
class
SymbolTable
{
public:
SymbolTableElement
**
table
;
static
int
nextTemporary
;
void
AddSymbol
(
SymbolInformation
*
);
SymbolInformation
*
LookupSymbol
(
string
&
);
VariableInformation
*
GenTemp
(
TypeInformation
*
);
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment