Commit e83a94b3 authored by zygzagZ's avatar zygzagZ

Fix Info

parent 8072a075
#include "Info.h"
Scope g_scope;
#ifndef INFO_HEADER #ifndef INFO_HEADER
#define INFO_HEADER #define INFO_HEADER
#include "Absyn.h" #include "Absyn.h"
using namespace std; using namespace std;
...@@ -10,7 +11,7 @@ class VarInfo { ...@@ -10,7 +11,7 @@ class VarInfo {
bool operator<(const VarInfo &other) const { bool operator<(const VarInfo &other) const {
return name != other.name ? name < other.name : type < other.type; return name != other.name ? name < other.name : type < other.type;
} }
} };
class FunctionInfo : VarInfo { class FunctionInfo : VarInfo {
vector<VarInfo> arguments; vector<VarInfo> arguments;
...@@ -26,5 +27,12 @@ public: ...@@ -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 ...@@ -7,7 +7,7 @@ FLEX_OPTS=-PGrammar
BISON=bison BISON=bison
BISON_OPTS=-t -pGrammar 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 .PHONY : clean distclean
...@@ -49,3 +49,6 @@ Latte.o : Latte.cpp Parser.h Printer.h Absyn.h ParseError.h ...@@ -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 TypeCheck.o : TypeCheck.cpp TypeCheck.h Absyn.h ParseError.h
${CC} ${CCFLAGS} -c TypeCheck.cpp ${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