Created a Poset template class. It can store the relationships of a partially ordered set, then generate a topological ordering. It will be used to order the type_def declarations in the CGenerator, as they depend on each other in a poset fashion.

This commit is contained in:
Nathan Braswell
2014-05-21 12:01:45 -04:00
parent 6350f93f24
commit d37a07201a
5 changed files with 124 additions and 10 deletions

View File

@@ -43,6 +43,8 @@ std::string CGenerator::generate(NodeTree<ASTData>* from, NodeTree<ASTData>* enc
switch (data.type) {
case translation_unit:
//Do here because we may need the typedefs before the declarations of variables
//Note that we need to be careful of the order, though, as some declarations depend on others.
//What is this then? It's a poset! Wooo posets!
for (int i = 0; i < children.size(); i++)
if (children[i]->getDataRef()->type == type_def)
output += generate(children[i], enclosingObject) + "\n";