Skip to content

Commit

Permalink
minifier fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dvtate committed Jun 20, 2022
1 parent 55bdb4f commit 549da68
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions compile/tree_to_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static inline std::string src_operator(AST& tree) {
static inline std::string src_statements(AST& tree) {
std::string ret;
for (auto& m : tree.members)
ret += tree_to_source(*m) + ";";
ret += tree_to_source(*m) + " ";
return ret;
}

Expand Down Expand Up @@ -86,8 +86,12 @@ std::string tree_to_source(AST& tree) {

case AST::NodeType::KV_PAIR:
return tree_to_source(*tree.members[0]) + ":" + tree_to_source(*tree.members[1]);
case AST::NodeType::DECLARATION:
return "let " + tree_to_source(*tree.members[0]);
case AST::NodeType::DECLARATION: {
std::string ret = "let " + tree_to_source(*tree.members[0]);
for (size_t i = 1; i < tree.members.size(); i++)
ret += "," + tree_to_source(*tree.members[i]);
return ret;
}
case AST::NodeType::STATEMENTS:
return src_statements(tree);
case AST::NodeType::INVOKE:
Expand Down
8 changes: 4 additions & 4 deletions examples/conway.s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let time = import('libtime.so');
let time = import('libtime.so')

// Useful stuff
let while = (:
Expand Down Expand Up @@ -89,8 +89,8 @@ let update_world = (:

// main loop
while ((: true ), (:
print_world()
update_world()
time.delay(0.04)
print_world()
update_world()
time.delay(0.04)
))

0 comments on commit 549da68

Please sign in to comment.