Implement new ordered typing in compiler series
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
%{
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include "ast.hpp"
|
||||
#include "definition.hpp"
|
||||
#include "parser.hpp"
|
||||
|
||||
std::vector<definition_data_ptr> defs_data;
|
||||
std::vector<definition_defn_ptr> defs_defn;
|
||||
std::map<std::string, definition_data_ptr> defs_data;
|
||||
std::map<std::string, definition_defn_ptr> defs_defn;
|
||||
|
||||
extern yy::parser::symbol_type yylex();
|
||||
|
||||
@@ -59,8 +60,8 @@ definitions
|
||||
;
|
||||
|
||||
definition
|
||||
: defn { defs_defn.push_back(std::move($1)); }
|
||||
| data { defs_data.push_back(std::move($1)); }
|
||||
: defn { auto name = $1->name; defs_defn[name] = std::move($1); }
|
||||
| data { auto name = $1->name; defs_data[name] = std::move($1); }
|
||||
;
|
||||
|
||||
defn
|
||||
|
||||
Reference in New Issue
Block a user