Start using driver, and switch to file IO.

This commit is contained in:
2020-09-09 13:00:06 -07:00
parent 2f09401685
commit a6839c548e
4 changed files with 80 additions and 17 deletions

View File

@@ -1,17 +1,21 @@
%{
%code requires {
#include <string>
#include <iostream>
#include <map>
#include <vector>
#include "ast.hpp"
#include "definition.hpp"
#include "parser.hpp"
#include "parsed_type.hpp"
definition_group global_defs;
class parse_driver;
using yyscan_t = void*;
}
extern yy::parser::symbol_type yylex();
%param { yyscan_t scanner }
%param { parse_driver& drv }
%}
%code {
#include "parse_driver.hpp"
}
%token BACKSLASH
%token PLUS
@@ -59,7 +63,7 @@ extern yy::parser::symbol_type yylex();
%%
program
: definitions { global_defs = std::move($1); global_defs.vis = visibility::global; }
: definitions { $1.vis = visibility::global; std::swap(drv.global_defs, $1); }
;
definitions