MimIR 0.1
MimIR is my Intermediate Representation
|
Parses Mim code as AST. More...
#include <mim/ast/parser.h>
Public Member Functions | |
Parser (AST &ast) | |
AST & | ast () |
Driver & | driver () |
Ptr< Module > | import (std::string_view sv) |
Ptr< Module > | import (Dbg, std::ostream *md=nullptr) |
Ptr< Module > | import (std::istream &, Loc={}, const fs::path *=nullptr, std::ostream *md=nullptr) |
Ptr< Module > | plugin (Dbg) |
Ptr< Module > | plugin (const std::string &s) |
Ptr< Module > | plugin (const char *name) |
Parses Mim code as AST.
The logic behind the various parse methods is as follows:
The parse_*
method does not have a std::string_view ctxt
parameter:
It's the caller's responsibility to first make appropriate FIRST/FOLLOW checks. Otherwise, an assertion will be triggered in the case of a syntax error.
The parse_*
method does have a std::string_view ctxt
parameter:
The called method checks this and spits out an appropriate error message using ctxt
in the case of a syntax error.
parse_*
method does have a std::string_view ctxt = {}
parameter with default argument:
|
inline |
|
inline |
Definition at line 117 of file parser.cpp.
References driver().
Ptr< Module > mim::ast::Parser::import | ( | std::istream & | is, |
Loc | loc = {}, | ||
const fs::path * | path = nullptr, | ||
std::ostream * | md = nullptr ) |
Definition at line 140 of file parser.cpp.
References ast(), driver(), and mim::ast::AST::error().
Definition at line 156 of file parser.cpp.
References driver(), and mim::Driver::load().