[ozulis] custom memory management is near completion, but i still have a bug :/
[ozulis.git] / src / plugins / lang / mugiwara / parser.cc
blob8acfc93f1d0ed976984e4862af1713bdd23a58a6
1 #include <ozulis/ast/ast.hh>
2 #include <ozulis/core/assert.hh>
4 #include "bison/parser.hh"
5 #include "bison/lexer.hh"
6 #include "parser.hh"
8 int mugiwara_parse(yyscan_t yyscanner, ozulis::ast::FilePtr & module);
10 namespace mugiwara
12 ozulis::ast::FilePtr
13 Parser::parse(FILE * stream)
15 ozulis::ast::FilePtr file = 0;
16 yyscan_t scanner;
18 mugiwara_lex_init(&scanner);
19 mugiwara_set_in(stream, scanner);
20 assert_msg(!mugiwara_parse(scanner, file), "parse error");
21 mugiwara_lex_destroy(scanner);
22 return file;