70 assert(
false &&
"kind not found!");
91 if ( std::isdigit(
c) ==
false )
94 <<
" Attribute:" <<
attributeStr <<
" (only number or single alphabet.)";
95 assert(
false &&
"grammar loading failed!");
106 std::string
key =
"";
109 if (
i.second == kind)
116 std::string
nkey =
"";
119 if (
ni.second == kind)
126 std::string
signs =
"";
129 if (
i.second == kind)
144 std::string
key =
"";
147 if (
i.second == kind)
153 key.append(std::to_string(attribute));
159 std::string
nkey =
"";
162 if (
ni.second == kind)
168 nkey.append(std::to_string(attribute));
267 if ( std::isdigit(
c) ==
false )
270 <<
" Attribute:" <<
attributeStr <<
" (only number or single alphabet.)";
271 assert(
false &&
"grammar loading failed!");
298 if ( std::isdigit(
c) ==
false )
301 <<
" Attribute:" <<
attributeStr <<
" (only number or single alphabet.)";
302 assert(
false &&
"grammar loading failed!");
348 dump(
"Normailized_Grammar.txt");
357 gramFile <<
"Epsilon Production:\n";
358 std::vector<std::string>
strV;
361 std::stringstream
ss;
372 std::sort(
strV.begin(),
strV.end());
387 std::stringstream
ss;
401 std::sort(
strV.begin(),
strV.end());
416 std::stringstream
ss;
431 std::sort(
strV.begin(),
strV.end());
SymbolMap< Symbol, Productions > firstRHSToProds
SymbolSet< Production > epsilonProds
SymbolMap< Symbol, Productions > singleRHSToProds
u32_t newTerminalSubscript
Map< std::string, Kind > terminals
std::string extractAttributeStrFromSymbolStr(const std::string &symbolStr) const
void setAttributeKinds(const Set< Kind > &attributeKind)
Symbol insertEBNFSigns(std::string strLit)
void setRawProductions(SymbolMap< Symbol, Productions > &rawProductions)
std::string extractKindStrFromSymbolStr(const std::string &symbolStr) const
Kind strToKind(std::string str) const
Symbol insertSymbol(std::string strLit)
Symbol strToSymbol(const std::string str) const
std::string symToStrDump(Symbol sym) const
SymbolMap< Symbol, Productions > rawProductions
Symbol insertNonTerminalSymbol(std::string strLit)
Symbol insertTerminalSymbol(std::string strLit)
Map< Kind, Set< Attribute > > kindToAttrsMap
Map< std::string, Kind > EBNFSigns
void insertAttribute(Kind kind, Attribute a)
Map< std::string, Kind > nonterminals
Kind insertNonterminalKind(std::string const kindStr)
Insert kind to nonterminal and return kind.
Set< Kind > attributeKinds
Map contains Signs' String and associated Symbols.
void setKindToAttrsMap(const Map< Kind, Set< Attribute > > &kindToAttrsMap)
std::string kindToStr(Kind kind) const
Kind insertTerminalKind(std::string strLit)
int isalpha(int character)
std::string errMsg(const std::string &msg)
Print error message by converting a string into red string output.
std::ostream & errs()
Overwrite llvm::errs()
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
llvm::IRBuilder IRBuilder