LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
parse::TigerParser Class Reference

Conduct the scanner and the parser. More...

#include <tiger-parser.hh>

Collaboration diagram for parse::TigerParser:

Public Types

typedef misc::variant
< std::string, Tweast * > 
input_type

Public Member Functions

 TigerParser (const misc::file_library &lib=misc::file_library())
virtual ~TigerParser ()
friend YY_DECL_ (::)
ast_type parse_file (const std::string &name)
 Parse the Tiger file name.
ast_type parse (Tweast &s)
 Parse the Tweast s. Extensions are enabled.
ast_type parse (const std::string &s)
 Parse the string s. Extensions are automatically disabled.
ast::DecsListparse_import (const std::string &name, const location &loc)
 Parse a Tiger prelude, return the list of decs.
const misc::errorerror_get () const
 Return the error status of the parsing.
const char * prelude () const
 The default prelude.
TigerParserscan_trace (bool b=true)
 Set the scanner traces.
TigerParserparse_trace (bool b=true)
 Set the parser traces.
TigerParserenable_object_extensions (bool b=true)
 Enable object extensions.
TigerParserenable_extensions (bool b=true)
 Enable syntax extensions.

Public Attributes

location location_
 The location requesting the import.
input_type input_
 The source to parse.
misc::file_library library_
 The file library for imports.
bool enable_object_extensions_p_
 Allow object extensions?
bool enable_extensions_p_
 Allow language extensions (reserved identifiers, new keywords)?

Private Attributes

Handling the scanner.

The scanner.

std::unique_ptr< yyFlexLexerscanner_
bool scan_trace_p_
 Verbose scanning?
std::map< std::string, location > open_files_
 The list of open files, and the location of their request.

Friends

class parser

Running the parse.

Parse a Tiger program, return the AST.

ast_type ast_
 The result of the parse.
misc::error error_
 Parsing errors handler.
bool parse_trace_p_
 Verbose parsing?
ast_type parse_ ()
 Parse a Tiger file or string.
ast_type parse_input (Tweast &input, bool extensions)
ast::DecsListparse_prelude (const std::string &f)
 Parse a Tiger prelude f, return the list of decs.

Detailed Description

Conduct the scanner and the parser.

Member Typedef Documentation

The parsed object is either a file, represented by the filename or a Tweast.

Constructor & Destructor Documentation

parse::TigerParser::TigerParser ( const misc::file_library lib = misc::file_library())
virtual parse::TigerParser::~TigerParser ( )
virtual

Member Function Documentation

TigerParser & parse::TigerParser::enable_extensions ( bool  b = true)

Enable syntax extensions.

References enable_extensions_p_.

Referenced by parse::parse().

TigerParser & parse::TigerParser::enable_object_extensions ( bool  b = true)

Enable object extensions.

References enable_object_extensions_p_.

Referenced by parse::parse(), and parse::parse_unit().

const misc::error & parse::TigerParser::error_get ( ) const

Return the error status of the parsing.

References error_.

Referenced by parse::parse(), and parse::parse_unit().

ast_type parse::TigerParser::parse ( Tweast s)

Parse the Tweast s. Extensions are enabled.

References parse_input().

Referenced by parse::parse(), and parse::parse_unit().

ast_type parse::TigerParser::parse ( const std::string &  s)

Parse the string s. Extensions are automatically disabled.

References parse_input().

ast_type parse::TigerParser::parse_ ( )
private

Parse a Tiger file or string.

References ast_, error_, misc::error::exit(), misc::error::failure, filename, input_, location_, and program_name.

Referenced by parse_file().

ast_type parse::TigerParser::parse_file ( const std::string &  name)

Parse the Tiger file name.

References input_, parse_(), and parse_trace_p_.

Referenced by parse::parse(), and parse_import().

ast::DecsList * parse::TigerParser::parse_import ( const std::string &  name,
const location &  loc 
)
ast_type parse::TigerParser::parse_input ( Tweast input,
bool  extensions 
)
private

Parse a Tweast. extensions temporarily enable or disable extensions for the string parsing. This method is used to factor code between parse (Tweast) and parse (const std::string))

References enable_extensions_p_, and parse::Tweast::flatten().

Referenced by parse().

ast::DecsList* parse::TigerParser::parse_prelude ( const std::string &  f)
private

Parse a Tiger prelude f, return the list of decs.

TigerParser & parse::TigerParser::parse_trace ( bool  b = true)

Set the parser traces.

References parse_trace_p_.

Referenced by parse::parse().

const char* parse::TigerParser::prelude ( ) const

The default prelude.

Referenced by parse::parse().

TigerParser & parse::TigerParser::scan_trace ( bool  b = true)

Set the scanner traces.

References scan_trace_p_.

Referenced by parse::parse().

parse::TigerParser::YY_DECL_ ( ::  )

Friends And Related Function Documentation

friend class parser
friend

Member Data Documentation

ast_type parse::TigerParser::ast_

The result of the parse.

Referenced by parse_().

bool parse::TigerParser::enable_extensions_p_

Allow language extensions (reserved identifiers, new keywords)?

Referenced by enable_extensions(), and parse_input().

bool parse::TigerParser::enable_object_extensions_p_

Allow object extensions?

Referenced by enable_object_extensions().

misc::error parse::TigerParser::error_

Parsing errors handler.

Referenced by error_get(), parse_(), and parse_import().

input_type parse::TigerParser::input_

The source to parse.

Referenced by parse_(), parse_file(), and parse_import().

misc::file_library parse::TigerParser::library_

The file library for imports.

Referenced by parse_import().

location parse::TigerParser::location_

The location requesting the import.

Referenced by parse_(), and parse_import().

std::map<std::string, location> parse::TigerParser::open_files_
private

The list of open files, and the location of their request.

Referenced by parse_import().

bool parse::TigerParser::parse_trace_p_

Verbose parsing?

Referenced by parse_file(), and parse_trace().

bool parse::TigerParser::scan_trace_p_
private

Verbose scanning?

Referenced by scan_trace().

std::unique_ptr<yyFlexLexer> parse::TigerParser::scanner_
private

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