mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
Poincare: Fix the rulegen
Change-Id: Ib672071daa3b4ca4575845fd11ec455c442acd8d
This commit is contained in:
@@ -14,17 +14,17 @@ void Builder::generateFields(Rule * context, std::string &indentation) {
|
||||
switch (m_type) {
|
||||
case Type::ExpressionType:
|
||||
std::cout << indentation << ".m_action = ExpressionBuilder::Action::BuildFromTypeAndValue," << std::endl;
|
||||
std::cout << indentation << ".m_expressionType = Expression::Type::" << *m_name << std::endl;
|
||||
std::cout << indentation << ".m_expressionType = Expression::Type::" << *m_name << "," << std::endl;
|
||||
break;
|
||||
case Type::Variable:
|
||||
std::cout << indentation << ".m_action = ExpressionBuilder::Action::Clone," << std::endl;
|
||||
assert(m_children->size() == 0);
|
||||
std::cout << indentation << ".m_matchIndex = " << selector->flatIndexOfChildNamed(*m_name) << std::endl;
|
||||
std::cout << indentation << ".m_matchIndex = " << selector->flatIndexOfChildNamed(*m_name) << "," << std::endl;
|
||||
break;
|
||||
case Type::Wildcard:
|
||||
std::cout << indentation << ".m_action = ExpressionBuilder::Action::BringUpWildcard," << std::endl;
|
||||
assert(m_children->size() == 0);
|
||||
std::cout << indentation << ".m_matchIndex = " << selector->flatIndexOfChildNamed(*m_name) << std::endl;
|
||||
std::cout << indentation << ".m_matchIndex = " << selector->flatIndexOfChildNamed(*m_name) << "," << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,13 @@ int yyerror(std::vector<Rule *> ** rules, char *s) {
|
||||
|
||||
int main(void) {
|
||||
std::vector<Rule *> * rules = new std::vector<Rule *>();
|
||||
|
||||
yyparse(&rules);
|
||||
|
||||
std::cout << "#include \"simplification_rules.h\"" << std::endl;
|
||||
std::cout << "#include \"simplification_generator.h\"" << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
int counter = 0;
|
||||
for (int i=0; i<rules->size(); i++) {
|
||||
std::stringstream name;
|
||||
@@ -125,6 +131,10 @@ int main(void) {
|
||||
}
|
||||
std::cout << "};" << std::endl;
|
||||
|
||||
std::cout << std::endl;
|
||||
std::cout << "const int knumberOfSimplifications = " << rules->size() << ";" << std::endl;
|
||||
|
||||
|
||||
delete rules;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ void Selector::generateFields(Rule * context, std::string &indentation) {
|
||||
assert(parent->m_children->back() == this);
|
||||
break;
|
||||
case Type::ExpressionType:
|
||||
std::cout << indentation << ".m_match = ExpressionSelector::Match::TypeAndValue," << std::endl;
|
||||
std::cout << indentation << ".m_match = ExpressionSelector::Match::Type," << std::endl;
|
||||
std::cout << indentation << ".m_expressionType = Expression::Type::" << *m_name << "," << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user