Gyoji Compiler
Loading...
Searching...
No Matches
symbols.hpp
1#pragma once
2
3#include <gyoji-misc/pointers.hpp>
4#include <gyoji-mir/types.hpp>
5
6#include <string>
7#include <map>
8#include <vector>
9
10namespace Gyoji::mir {
11
24 class Symbol {
25 public:
33 Symbol(std::string _name, const Type *_type);
34
41 ~Symbol();
42
46 std::string get_name() const;
51 const Type *get_type() const;
52 private:
53 std::string name;
54 const Type *type;
55 };
56
72 class Symbols {
73 public:
77 Symbols();
84 ~Symbols();
85
95 void define_symbol(std::string name, const Type *symbol_type);
96
105 const Symbol * get_symbol(std::string name) const;
106
111 void dump(FILE *out) const;
112 private:
114 };
115
116};
117
A symbol defined globally inside a namespace.
Definition symbols.hpp:24
~Symbol()
Move along, nothing to see here.
Definition symbols.cpp:10
std::string get_name() const
Definition symbols.cpp:14
const Type * get_type() const
Definition symbols.cpp:18
Symbol table for the intermediate representation (MIR)
Definition symbols.hpp:72
void define_symbol(std::string name, const Type *symbol_type)
Create a new global symbol.
Definition symbols.cpp:30
const Symbol * get_symbol(std::string name) const
Look up a symbol by name.
Definition symbols.cpp:52
Symbols()
Definition symbols.cpp:23
void dump(FILE *out) const
Definition symbols.cpp:40
~Symbols()
Move along, nothing to see here.
Definition symbols.cpp:26
This represents a type as declared in a translation unit.
Definition types.hpp:299
Middle intermediate representation (MIR) of a translation unit.
Definition gyoji-mir.hpp:37