Implement while loops

This commit is contained in:
2024-12-28 14:33:35 +01:00
parent d46608b358
commit 20949c7829
7 changed files with 257 additions and 46 deletions

View File

@ -8,6 +8,12 @@
#include "elna/source/result.h"
location_t elna_gcc_location(const elna::source::position *position);
namespace elna
{
namespace gcc
{
location_t get_location(const elna::source::position *position);
const char *elna_gcc_print_type(tree type);
const char *print_type(tree type);
}
}

View File

@ -20,6 +20,9 @@ namespace gcc
tree current_statements{ NULL_TREE };
tree current_expression{ NULL_TREE };
std::unordered_map<std::string, tree> symbol_map;
tree main_fndecl{ NULL_TREE };
tree build_label_decl (const char *name, location_t loc);
public:
void visit(source::program *program) override;
@ -30,6 +33,8 @@ namespace gcc
void visit(source::declaration *declaration) override;
void visit(source::variable_expression *expression) override;
void visit(source::assign_statement *statement) override;
void visit(source::if_statement *statement) override;
void visit(source::while_statement *statement) override;
};
}
}

View File

@ -486,5 +486,7 @@ namespace source
expression& operand();
unary_operator operation() const noexcept;
};
const char *print_binary_operator(const binary_operator operation);
}
}