MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::ast::Parser Class Reference

Parses Mim code as AST. More...

#include <mim/ast/parser.h>

Inheritance diagram for mim::ast::Parser:
[legend]

Public Member Functions

 Parser (AST &ast)
 
ASTast ()
 
Driverdriver ()
 
Ptr< Moduleimport (std::string_view sv)
 
Ptr< Moduleimport (Dbg, std::ostream *md=nullptr)
 
Ptr< Moduleimport (std::istream &, Loc={}, const fs::path *=nullptr, std::ostream *md=nullptr)
 
Ptr< Moduleplugin (Dbg)
 
Ptr< Moduleplugin (const std::string &s)
 
Ptr< Moduleplugin (const char *name)
 

Detailed Description

Parses Mim code as AST.

The logic behind the various parse methods is as follows:

  1. 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.

  2. 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.

  3. The parse_* method does have a std::string_view ctxt = {} parameter with default argument:
    • If default argument is elided we have the same behavior as in 1.
    • If default argument is provided we have the same behavior as in 2.

Definition at line 30 of file parser.h.

Constructor & Destructor Documentation

◆ Parser()

mim::ast::Parser::Parser ( AST & ast)
inline

Definition at line 34 of file parser.h.

Member Function Documentation

◆ ast()

AST & mim::ast::Parser::ast ( )
inline

Definition at line 37 of file parser.h.

Referenced by driver(), and import().

◆ driver()

Driver & mim::ast::Parser::driver ( )
inline

Definition at line 38 of file parser.h.

References ast(), and mim::ast::AST::driver().

Referenced by import(), import(), import(), plugin(), plugin(), and plugin().

◆ import() [1/3]

Ptr< Module > mim::ast::Parser::import ( Dbg dbg,
std::ostream * md = nullptr )

Definition at line 117 of file parser.cpp.

References driver().

◆ import() [2/3]

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().

◆ import() [3/3]

Ptr< Module > mim::ast::Parser::import ( std::string_view sv)
inline

Definition at line 39 of file parser.h.

References driver().

◆ plugin() [1/3]

Ptr< Module > mim::ast::Parser::plugin ( const char * name)
inline

Definition at line 44 of file parser.h.

References driver(), and plugin().

Referenced by plugin().

◆ plugin() [2/3]

Ptr< Module > mim::ast::Parser::plugin ( const std::string & s)
inline

Definition at line 43 of file parser.h.

References driver(), and plugin().

Referenced by plugin().

◆ plugin() [3/3]

Ptr< Module > mim::ast::Parser::plugin ( Dbg dbg)

Definition at line 156 of file parser.cpp.

References driver(), and mim::Driver::load().


The documentation for this class was generated from the following files: