Rename elna::source to elna:boot
This commit is contained in:
@ -7,11 +7,11 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "elna/source/result.h"
|
||||
#include "elna/boot/result.h"
|
||||
|
||||
namespace elna
|
||||
{
|
||||
namespace source
|
||||
namespace boot
|
||||
{
|
||||
enum class binary_operator
|
||||
{
|
||||
@ -47,7 +47,7 @@ namespace source
|
||||
class if_statement;
|
||||
class while_statement;
|
||||
class return_statement;
|
||||
class expression_statement;
|
||||
class call_statement;
|
||||
class block;
|
||||
class program;
|
||||
class binary_expression;
|
||||
@ -77,7 +77,7 @@ namespace source
|
||||
virtual void visit(call_expression *) = 0;
|
||||
virtual void visit(cast_expression *) = 0;
|
||||
virtual void visit(size_of_expression *) = 0;
|
||||
virtual void visit(expression_statement *) = 0;
|
||||
virtual void visit(call_statement *) = 0;
|
||||
virtual void visit(assign_statement *) = 0;
|
||||
virtual void visit(if_statement *) = 0;
|
||||
virtual void visit(while_statement *) = 0;
|
||||
@ -116,7 +116,7 @@ namespace source
|
||||
virtual void visit(call_expression *expression) override;
|
||||
virtual void visit(cast_expression *expression) override;
|
||||
virtual void visit(size_of_expression *expression) override;
|
||||
virtual void visit(expression_statement *statement) override;
|
||||
virtual void visit(call_statement *statement) override;
|
||||
virtual void visit(assign_statement *statement) override;
|
||||
virtual void visit(if_statement *) override;
|
||||
virtual void visit(while_statement *) override;
|
||||
@ -458,17 +458,17 @@ namespace source
|
||||
virtual ~size_of_expression() override;
|
||||
};
|
||||
|
||||
class expression_statement : public statement
|
||||
class call_statement : public statement
|
||||
{
|
||||
expression *m_body;
|
||||
call_expression *m_body;
|
||||
|
||||
public:
|
||||
expression_statement(const struct position position, expression *body);
|
||||
call_statement(const struct position position, call_expression *body);
|
||||
virtual void accept(parser_visitor *visitor) override;
|
||||
|
||||
expression& body();
|
||||
call_expression& body();
|
||||
|
||||
virtual ~expression_statement() override;
|
||||
virtual ~call_statement() override;
|
||||
};
|
||||
|
||||
/**
|
@ -5,12 +5,12 @@
|
||||
|
||||
#include <list>
|
||||
#include <optional>
|
||||
#include "elna/source/ast.h"
|
||||
#include "elna/boot/ast.h"
|
||||
#include "location.hh"
|
||||
|
||||
namespace elna
|
||||
{
|
||||
namespace source
|
||||
namespace boot
|
||||
{
|
||||
position make_position(const yy::location& location);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
namespace elna
|
||||
{
|
||||
namespace source
|
||||
namespace boot
|
||||
{
|
||||
/**
|
||||
* Position in the source text.
|
@ -10,7 +10,7 @@
|
||||
|
||||
namespace elna
|
||||
{
|
||||
namespace source
|
||||
namespace boot
|
||||
{
|
||||
/**
|
||||
* Generic language entity information.
|
@ -6,13 +6,13 @@
|
||||
#include "input.h"
|
||||
#include "tree.h"
|
||||
|
||||
#include "elna/source/result.h"
|
||||
#include "elna/boot/result.h"
|
||||
|
||||
namespace elna
|
||||
{
|
||||
namespace gcc
|
||||
{
|
||||
location_t get_location(const elna::source::position *position);
|
||||
location_t get_location(const boot::position *position);
|
||||
|
||||
const char *print_type(tree type);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "elna/source/ast.h"
|
||||
#include "elna/source/symbol.h"
|
||||
#include "elna/boot/ast.h"
|
||||
#include "elna/boot/symbol.h"
|
||||
#include "elna/gcc/elna-tree.h"
|
||||
|
||||
#include "config.h"
|
||||
@ -17,54 +17,56 @@ namespace elna
|
||||
{
|
||||
namespace gcc
|
||||
{
|
||||
class generic_visitor final : public source::empty_visitor
|
||||
class generic_visitor final : public boot::empty_visitor
|
||||
{
|
||||
tree current_statements{ NULL_TREE };
|
||||
tree current_expression{ NULL_TREE };
|
||||
std::shared_ptr<source::symbol_table<tree>> symbol_map;
|
||||
std::shared_ptr<boot::symbol_table<tree>> symbol_map;
|
||||
tree main_fndecl{ NULL_TREE };
|
||||
tree_chain variable_chain;
|
||||
|
||||
tree build_label_decl(const char *name, location_t loc);
|
||||
tree build_type(source::type_expression& type);
|
||||
tree build_type(boot::type_expression& type);
|
||||
|
||||
void enter_scope();
|
||||
tree_symbol_mapping leave_scope();
|
||||
|
||||
void build_binary_operation(bool condition, source::binary_expression *expression,
|
||||
void build_binary_operation(bool condition, boot::binary_expression *expression,
|
||||
tree_code operator_code, tree left, tree right, tree target_type);
|
||||
|
||||
void make_if_branch(source::conditional_statements& branch, tree goto_endif);
|
||||
void make_if_branch(boot::conditional_statements& branch, tree goto_endif);
|
||||
|
||||
bool is_integral_type(tree type);
|
||||
|
||||
public:
|
||||
generic_visitor(std::shared_ptr<source::symbol_table<tree>> symbol_table);
|
||||
generic_visitor(std::shared_ptr<boot::symbol_table<tree>> symbol_table);
|
||||
|
||||
void visit(source::program *program) override;
|
||||
void visit(source::procedure_definition *definition) override;
|
||||
void visit(source::call_expression *expression) override;
|
||||
void visit(source::cast_expression *expression) override;
|
||||
void visit(source::size_of_expression *expression) override;
|
||||
void visit(source::number_literal<std::int32_t> *literal) override;
|
||||
void visit(source::number_literal<std::uint32_t> *literal) override;
|
||||
void visit(source::number_literal<double> *literal) override;
|
||||
void visit(source::number_literal<bool> *boolean) override;
|
||||
void visit(source::number_literal<unsigned char> *character) override;
|
||||
void visit(source::number_literal<std::nullptr_t> *) override;
|
||||
void visit(source::string_literal *string) override;
|
||||
void visit(source::binary_expression *expression) override;
|
||||
void visit(source::unary_expression *expression) override;
|
||||
void visit(source::constant_definition *definition) override;
|
||||
void visit(source::type_definition *definition) override;
|
||||
void visit(source::variable_declaration *declaration) override;
|
||||
void visit(source::variable_expression *expression) override;
|
||||
void visit(source::array_access_expression *expression) override;
|
||||
void visit(source::field_access_expression *expression) override;
|
||||
void visit(source::dereference_expression *expression) override;
|
||||
void visit(source::assign_statement *statement) override;
|
||||
void visit(source::if_statement *statement) override;
|
||||
void visit(source::while_statement *statement) override;
|
||||
void visit(source::expression_statement *statement) override;
|
||||
void visit(source::return_statement *statement) override;
|
||||
void visit(boot::program *program) override;
|
||||
void visit(boot::procedure_definition *definition) override;
|
||||
void visit(boot::call_expression *expression) override;
|
||||
void visit(boot::cast_expression *expression) override;
|
||||
void visit(boot::size_of_expression *expression) override;
|
||||
void visit(boot::number_literal<std::int32_t> *literal) override;
|
||||
void visit(boot::number_literal<std::uint32_t> *literal) override;
|
||||
void visit(boot::number_literal<double> *literal) override;
|
||||
void visit(boot::number_literal<bool> *boolean) override;
|
||||
void visit(boot::number_literal<unsigned char> *character) override;
|
||||
void visit(boot::number_literal<std::nullptr_t> *) override;
|
||||
void visit(boot::string_literal *string) override;
|
||||
void visit(boot::binary_expression *expression) override;
|
||||
void visit(boot::unary_expression *expression) override;
|
||||
void visit(boot::constant_definition *definition) override;
|
||||
void visit(boot::type_definition *definition) override;
|
||||
void visit(boot::variable_declaration *declaration) override;
|
||||
void visit(boot::variable_expression *expression) override;
|
||||
void visit(boot::array_access_expression *expression) override;
|
||||
void visit(boot::field_access_expression *expression) override;
|
||||
void visit(boot::dereference_expression *expression) override;
|
||||
void visit(boot::assign_statement *statement) override;
|
||||
void visit(boot::if_statement *statement) override;
|
||||
void visit(boot::while_statement *statement) override;
|
||||
void visit(boot::call_statement *statement) override;
|
||||
void visit(boot::return_statement *statement) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "tree.h"
|
||||
#include "tree.h"
|
||||
|
||||
#include "elna/source/symbol.h"
|
||||
#include "elna/boot/symbol.h"
|
||||
|
||||
enum elna_tree_index
|
||||
{
|
||||
@ -27,7 +27,6 @@ namespace gcc
|
||||
void init_ttree();
|
||||
bool is_pointer_type(tree type);
|
||||
bool is_string_type(tree type);
|
||||
bool is_integral_type(tree type);
|
||||
|
||||
class tree_chain_base
|
||||
{
|
||||
@ -60,6 +59,6 @@ namespace gcc
|
||||
tree block();
|
||||
};
|
||||
|
||||
std::shared_ptr<source::symbol_table<tree>> builtin_symbol_table();
|
||||
std::shared_ptr<boot::symbol_table<tree>> builtin_symbol_table();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user