Tenncor
parse.hpp
Go to the documentation of this file.
1 
10 #include "opt/optimize.hpp"
11 
12 #ifndef OPT_PARSE_HPP
13 #define OPT_PARSE_HPP
14 
15 namespace opt
16 {
17 
19 struct RulesContext final
20 {
22  std::unordered_set<std::string> symbols_;
23 
25  std::unordered_map<std::string,
26  std::unordered_set<std::string>> properties_;
27 };
28 
31 {
32  virtual ~iConverterBuilder (void) = default;
33 
35  virtual CstConvertF build_cconv (void) const = 0;
36 
39  virtual ConvptrT build (const ::Subgraph* sg, const RulesContext& ctx) const = 0;
40 
42  virtual teq::CoordptrT shaperize (::NumList* list) const = 0;
43 
45  virtual teq::CoordptrT coorderize (::NumList* list) const = 0;
46 };
47 
49 OptCtx parse (std::string content, const iConverterBuilder& builder);
50 
52 OptCtx parse_file (std::string filename, const iConverterBuilder& builder);
53 
54 }
55 
56 #endif // OPT_PARSE_HPP
std::unordered_set< std::string > symbols_
Set of declared ANY typed rule node id.
Definition: parse.hpp:22
virtual ConvptrT build(const ::Subgraph *sg, const RulesContext &ctx) const =0
virtual teq::CoordptrT coorderize(::NumList *list) const =0
Return coordinate mapper given parsed C representation.
std::shared_ptr< iCoordMap > CoordptrT
Type of iCoordMap smartpointer.
Definition: coord.hpp:106
Decimal linked list.
Definition: list.h:26
Definition: candidate.hpp:19
Interface for TEQ extensions to construct conversion rules.
Definition: parse.hpp:30
Encapsulation of all conversion rules.
Definition: optimize.hpp:23
virtual ~iConverterBuilder(void)=default
std::shared_ptr< iConverter > ConvptrT
Smart pointer of converter.
Definition: iconverter.hpp:36
OptCtx parse(std::string content, const iConverterBuilder &builder)
Return all parsed optimization rules of string content.
std::function< teq::TensptrT(teq::iTensor *)> CstConvertF
Definition: optimize.hpp:20
virtual CstConvertF build_cconv(void) const =0
Return converter func that identifies extended TEQ specific constants.
Global statements shared between all rule statements.
Definition: parse.hpp:19
OptCtx parse_file(std::string filename, const iConverterBuilder &builder)
Return all parsed optimization rules of a file.
std::unordered_map< std::string, std::unordered_set< std::string > > properties_
Map functor/group label to set of associated properties.
Definition: parse.hpp:26
virtual teq::CoordptrT shaperize(::NumList *list) const =0
Return shape mapper given parsed C representation.