Commit e83a94b3 authored by zygzagZ's avatar zygzagZ

Fix Info

parent 8072a075
#include "Info.h"
Scope g_scope;
#ifndef INFO_HEADER
#define INFO_HEADER
#include "Absyn.h"
using namespace std;
......@@ -10,7 +11,7 @@ class VarInfo {
bool operator<(const VarInfo &other) const {
return name != other.name ? name < other.name : type < other.type;
}
}
};
class FunctionInfo : VarInfo {
vector<VarInfo> arguments;
......@@ -26,5 +27,12 @@ public:
};
vector<ClassInfo> classes;
vector<FunctionInfo> functions;
class Scope {
public:
vector<ClassInfo> classes;
vector<FunctionInfo> functions;
};
extern Scope g_scope;
#endif
\ No newline at end of file
......@@ -7,7 +7,7 @@ FLEX_OPTS=-PGrammar
BISON=bison
BISON_OPTS=-t -pGrammar
OBJS=Absyn.o Lexer.o Parser.o Printer.o TypeCheck.o
OBJS=Absyn.o Lexer.o Parser.o Printer.o TypeCheck.o Info.o
.PHONY : clean distclean
......@@ -49,3 +49,6 @@ Latte.o : Latte.cpp Parser.h Printer.h Absyn.h ParseError.h
TypeCheck.o : TypeCheck.cpp TypeCheck.h Absyn.h ParseError.h
${CC} ${CCFLAGS} -c TypeCheck.cpp
Info.o : Info.cpp Info.h Absyn.h
${CC} ${CCFLAGS} -c Info.cpp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment