Skip parameter names in procedure type expressions
This commit is contained in:
		
							
								
								
									
										28
									
								
								boot/ast.cc
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								boot/ast.cc
									
									
									
									
									
								
							@@ -17,9 +17,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
 | 
			
		||||
#include "elna/boot/ast.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace boot
 | 
			
		||||
namespace elna::boot
 | 
			
		||||
{
 | 
			
		||||
    void empty_visitor::visit(variable_declaration *)
 | 
			
		||||
    {
 | 
			
		||||
@@ -538,14 +536,19 @@ namespace boot
 | 
			
		||||
        delete m_body;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    procedure_type_expression::procedure_type_expression(const struct position position,
 | 
			
		||||
            std::shared_ptr<type_expression> return_type)
 | 
			
		||||
        : type_expression(position), return_type(return_type), no_return(false)
 | 
			
		||||
    return_declaration::return_declaration(std::shared_ptr<type_expression> type)
 | 
			
		||||
        : type(type)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    procedure_type_expression::procedure_type_expression(const struct position position, no_return_t)
 | 
			
		||||
        : type_expression(position), return_type(nullptr), no_return(true)
 | 
			
		||||
    return_declaration::return_declaration(std::monostate)
 | 
			
		||||
        : no_return(true)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    procedure_type_expression::procedure_type_expression(const struct position position,
 | 
			
		||||
            return_declaration return_type)
 | 
			
		||||
        : type_expression(position), return_type(return_type)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -554,14 +557,6 @@ namespace boot
 | 
			
		||||
        visitor->visit(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    procedure_type_expression::~procedure_type_expression()
 | 
			
		||||
    {
 | 
			
		||||
        for (auto parameter : this->parameters)
 | 
			
		||||
        {
 | 
			
		||||
            delete parameter;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    procedure_definition::procedure_definition(const struct position position, const std::string& identifier,
 | 
			
		||||
            const bool exported, std::shared_ptr<procedure_type_expression> heading, block *body)
 | 
			
		||||
        : definition(position, identifier, exported), m_heading(heading), body(body)
 | 
			
		||||
@@ -1212,4 +1207,3 @@ namespace boot
 | 
			
		||||
        __builtin_unreachable();
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -17,9 +17,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
 | 
			
		||||
#include "elna/boot/driver.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace boot
 | 
			
		||||
namespace elna::boot
 | 
			
		||||
{
 | 
			
		||||
    position make_position(const yy::location& location)
 | 
			
		||||
    {
 | 
			
		||||
@@ -79,4 +77,3 @@ namespace boot
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -122,10 +122,9 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
%type <elna::boot::literal *> literal;
 | 
			
		||||
%type <elna::boot::constant_definition *> constant_definition;
 | 
			
		||||
%type <std::vector<elna::boot::constant_definition *>> constant_part constant_definitions;
 | 
			
		||||
%type <std::vector<elna::boot::variable_declaration *>> variable_declarations variable_part variable_declaration
 | 
			
		||||
    formal_parameters formal_parameter_list;
 | 
			
		||||
%type <elna::boot::variable_declaration *> formal_parameter
 | 
			
		||||
%type <std::vector<elna::boot::variable_declaration *>> variable_declarations variable_part variable_declaration;
 | 
			
		||||
%type <std::shared_ptr<elna::boot::type_expression>> type_expression;
 | 
			
		||||
%type <std::vector<std::shared_ptr<elna::boot::type_expression>>> type_expressions;
 | 
			
		||||
%type <elna::boot::traits_expression *> traits_expression;
 | 
			
		||||
%type <elna::boot::expression *> expression operand;
 | 
			
		||||
%type <elna::boot::unary_expression *> unary_expression;
 | 
			
		||||
@@ -140,14 +139,15 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
%type <elna::boot::statement *> statement;
 | 
			
		||||
%type <std::vector<elna::boot::statement *>> statements;
 | 
			
		||||
%type <elna::boot::procedure_definition *> procedure_definition;
 | 
			
		||||
%type <std::shared_ptr<elna::boot::procedure_type_expression>> procedure_heading;
 | 
			
		||||
%type <std::pair<std::vector<std::string>, std::shared_ptr<elna::boot::procedure_type_expression>>> procedure_heading;
 | 
			
		||||
%type <elna::boot::return_declaration> return_declaration;
 | 
			
		||||
%type <std::vector<elna::boot::procedure_definition *>> procedure_definitions procedure_part;
 | 
			
		||||
%type <elna::boot::type_definition *> type_definition;
 | 
			
		||||
%type <std::vector<elna::boot::type_definition *>> type_definitions type_part;
 | 
			
		||||
%type <elna::boot::block *> block;
 | 
			
		||||
%type <elna::boot::field_declaration> field_declaration;
 | 
			
		||||
%type <elna::boot::field_declaration> field_declaration formal_parameter;
 | 
			
		||||
%type <std::vector<std::pair<std::string, std::shared_ptr<elna::boot::type_expression>>>>
 | 
			
		||||
    optional_fields required_fields;
 | 
			
		||||
    optional_fields required_fields formal_parameters;
 | 
			
		||||
%type <std::vector<elna::boot::conditional_statements *>> elsif_then_statements elsif_do_statements;
 | 
			
		||||
%type <elna::boot::cast_expression *> cast_expression;
 | 
			
		||||
%type <elna::boot::defer_statement *> defer_statement;
 | 
			
		||||
@@ -191,31 +191,32 @@ identifier_definitions:
 | 
			
		||||
            $$.emplace($$.cbegin(), $1);
 | 
			
		||||
        }
 | 
			
		||||
    | identifier_definition { $$.emplace_back(std::move($1)); }
 | 
			
		||||
return_declaration:
 | 
			
		||||
    /* proper procedure */ {}
 | 
			
		||||
    | "->" "!" { $$ = elna::boot::return_declaration(std::monostate{}); }
 | 
			
		||||
    | "->" type_expression { $$ = elna::boot::return_declaration($2); }
 | 
			
		||||
procedure_heading:
 | 
			
		||||
    formal_parameter_list
 | 
			
		||||
    "(" formal_parameters ")" return_declaration
 | 
			
		||||
        {
 | 
			
		||||
            $$ = std::make_shared<elna::boot::procedure_type_expression>(elna::boot::make_position(@1));
 | 
			
		||||
            std::swap($1, $$->parameters);
 | 
			
		||||
        }
 | 
			
		||||
    | formal_parameter_list "->" "!"
 | 
			
		||||
        {
 | 
			
		||||
            $$ = std::make_shared<elna::boot::procedure_type_expression>(elna::boot::make_position(@1),
 | 
			
		||||
                elna::boot::no_return);
 | 
			
		||||
            std::swap($1, $$->parameters);
 | 
			
		||||
        }
 | 
			
		||||
    | formal_parameter_list "->" type_expression
 | 
			
		||||
        {
 | 
			
		||||
            $$ = std::make_shared<elna::boot::procedure_type_expression>(elna::boot::make_position(@1), $3);
 | 
			
		||||
            std::swap($1, $$->parameters);
 | 
			
		||||
            $$.second = std::make_shared<elna::boot::procedure_type_expression>(elna::boot::make_position(@1),
 | 
			
		||||
                    std::move($4));
 | 
			
		||||
            for (auto& [name, type] : $2)
 | 
			
		||||
            {
 | 
			
		||||
                $$.first.emplace_back(std::move(name));
 | 
			
		||||
                $$.second->parameters.push_back(type);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
procedure_definition:
 | 
			
		||||
    "proc" identifier_definition procedure_heading ";" block
 | 
			
		||||
        {
 | 
			
		||||
            $$ = new elna::boot::procedure_definition(elna::boot::make_position(@1), $2.first, $2.second, $3, $5);
 | 
			
		||||
            $$ = new elna::boot::procedure_definition(elna::boot::make_position(@1),
 | 
			
		||||
                    $2.first, $2.second, $3.second, $5);
 | 
			
		||||
            std::swap($3.first, $$->parameter_names);
 | 
			
		||||
        }
 | 
			
		||||
    | "proc" identifier_definition procedure_heading ";" "extern"
 | 
			
		||||
        {
 | 
			
		||||
            $$ = new elna::boot::procedure_definition(elna::boot::make_position(@1), $2.first, $2.second, $3);
 | 
			
		||||
            $$ = new elna::boot::procedure_definition(elna::boot::make_position(@1), $2.first, $2.second, $3.second);
 | 
			
		||||
            std::swap($3.first, $$->parameter_names);
 | 
			
		||||
        }
 | 
			
		||||
procedure_definitions:
 | 
			
		||||
    procedure_definition procedure_definitions
 | 
			
		||||
@@ -438,7 +439,14 @@ expressions:
 | 
			
		||||
            std::swap($$, $3);
 | 
			
		||||
            $$.emplace($$.cbegin(), $1);
 | 
			
		||||
        }
 | 
			
		||||
    | expression { $$.emplace_back(std::move($1)); }
 | 
			
		||||
    | expression { $$.push_back($1); }
 | 
			
		||||
type_expressions:
 | 
			
		||||
    type_expression "," type_expressions
 | 
			
		||||
        {
 | 
			
		||||
            std::swap($$, $3);
 | 
			
		||||
            $$.emplace($$.cbegin(), $1);
 | 
			
		||||
        }
 | 
			
		||||
    | type_expression { $$.push_back($1); }
 | 
			
		||||
designator_expression:
 | 
			
		||||
    operand "[" expression "]"
 | 
			
		||||
        {
 | 
			
		||||
@@ -500,9 +508,12 @@ type_expression:
 | 
			
		||||
        {
 | 
			
		||||
            $$ = std::make_shared<elna::boot::union_type_expression>(elna::boot::make_position(@1), std::move($2));
 | 
			
		||||
        }
 | 
			
		||||
    | "proc" procedure_heading
 | 
			
		||||
    | "proc" "(" type_expressions ")" return_declaration
 | 
			
		||||
        {
 | 
			
		||||
            $$ = $2;
 | 
			
		||||
            auto result = std::make_shared<elna::boot::procedure_type_expression>(elna::boot::make_position(@1),
 | 
			
		||||
                    std::move($5));
 | 
			
		||||
            std::swap(result->parameters, $3);
 | 
			
		||||
            $$ = result;
 | 
			
		||||
        }
 | 
			
		||||
    | IDENTIFIER
 | 
			
		||||
        {
 | 
			
		||||
@@ -559,18 +570,16 @@ type_part:
 | 
			
		||||
    | "type" type_definitions { std::swap($$, $2); }
 | 
			
		||||
formal_parameter: IDENTIFIER ":" type_expression
 | 
			
		||||
        {
 | 
			
		||||
            $$ = new elna::boot::variable_declaration(elna::boot::make_position(@2), $1, $3);
 | 
			
		||||
            $$ = std::make_pair($1, $3);
 | 
			
		||||
        }
 | 
			
		||||
formal_parameters:
 | 
			
		||||
    formal_parameter "," formal_parameters
 | 
			
		||||
    /* no formal parameters */ {}
 | 
			
		||||
    | formal_parameter "," formal_parameters
 | 
			
		||||
        {
 | 
			
		||||
            std::swap($$, $3);
 | 
			
		||||
            $$.emplace($$.cbegin(), $1);
 | 
			
		||||
        }
 | 
			
		||||
    | formal_parameter { $$.emplace_back(std::move($1)); }
 | 
			
		||||
formal_parameter_list:
 | 
			
		||||
    "(" ")" {}
 | 
			
		||||
    | "(" formal_parameters ")" { std::swap($$, $2); }
 | 
			
		||||
actual_parameter_list:
 | 
			
		||||
    "(" ")" {}
 | 
			
		||||
    | "(" expressions ")" { std::swap($$, $2); }
 | 
			
		||||
 
 | 
			
		||||
@@ -17,9 +17,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
 | 
			
		||||
#include "elna/boot/result.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace boot
 | 
			
		||||
namespace elna::boot
 | 
			
		||||
{
 | 
			
		||||
    error::error(const char *path, const struct position position)
 | 
			
		||||
        : position(position), path(path)
 | 
			
		||||
@@ -46,4 +44,3 @@ namespace boot
 | 
			
		||||
        return m_errors;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -17,9 +17,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
 | 
			
		||||
#include "elna/boot/semantic.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace boot
 | 
			
		||||
namespace elna::boot
 | 
			
		||||
{
 | 
			
		||||
    undeclared_error::undeclared_error(const std::string& identifier, const char *path, const struct position position)
 | 
			
		||||
        : error(path, position), identifier(identifier)
 | 
			
		||||
@@ -122,4 +120,3 @@ namespace boot
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -17,9 +17,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
 | 
			
		||||
#include "elna/boot/symbol.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace boot
 | 
			
		||||
namespace elna::boot
 | 
			
		||||
{
 | 
			
		||||
    type::type()
 | 
			
		||||
    {
 | 
			
		||||
@@ -301,4 +299,3 @@ namespace boot
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -21,9 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
#include "stringpool.h"
 | 
			
		||||
#include "elna/gcc/elna-tree.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace gcc
 | 
			
		||||
namespace elna::gcc
 | 
			
		||||
{
 | 
			
		||||
    void init_ttree()
 | 
			
		||||
    {
 | 
			
		||||
@@ -66,4 +64,3 @@ namespace gcc
 | 
			
		||||
        return symbol_table;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,9 +19,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
#include "elna/gcc/elna-tree.h"
 | 
			
		||||
#include "elna/gcc/elna1.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace gcc
 | 
			
		||||
namespace elna::gcc
 | 
			
		||||
{
 | 
			
		||||
    location_t get_location(const boot::position *position)
 | 
			
		||||
    {
 | 
			
		||||
@@ -144,4 +142,3 @@ namespace gcc
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -34,9 +34,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
#include "fold-const.h"
 | 
			
		||||
#include "langhooks.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace gcc
 | 
			
		||||
namespace elna::gcc
 | 
			
		||||
{
 | 
			
		||||
    tree get_inner_alias(const boot::type& type, std::shared_ptr<symbol_table> symbols)
 | 
			
		||||
    {
 | 
			
		||||
@@ -317,7 +315,7 @@ namespace gcc
 | 
			
		||||
        tree fndecl = build_fn_decl(definition->identifier.c_str(), declaration_type);
 | 
			
		||||
        this->symbols->enter(definition->identifier, fndecl);
 | 
			
		||||
 | 
			
		||||
        if (definition->heading().no_return)
 | 
			
		||||
        if (definition->heading().return_type.no_return)
 | 
			
		||||
        {
 | 
			
		||||
            TREE_THIS_VOLATILE(fndecl) = 1;
 | 
			
		||||
        }
 | 
			
		||||
@@ -336,19 +334,22 @@ namespace gcc
 | 
			
		||||
        function_args_iterator parameter_type;
 | 
			
		||||
        function_args_iter_init(¶meter_type, declaration_type);
 | 
			
		||||
 | 
			
		||||
        for (const boot::variable_declaration *parameter : definition->heading().parameters)
 | 
			
		||||
        std::vector<std::string>::const_iterator parameter_name = definition->parameter_names.cbegin();
 | 
			
		||||
 | 
			
		||||
        for (std::shared_ptr<boot::type_expression> parameter : definition->heading().parameters)
 | 
			
		||||
        {
 | 
			
		||||
            tree declaration_tree = build_decl(get_location(¶meter->position()), PARM_DECL,
 | 
			
		||||
                get_identifier(parameter->identifier.c_str()), function_args_iter_cond(¶meter_type));
 | 
			
		||||
                get_identifier(parameter_name->c_str()), function_args_iter_cond(¶meter_type));
 | 
			
		||||
            DECL_CONTEXT(declaration_tree) = fndecl;
 | 
			
		||||
            DECL_ARG_TYPE(declaration_tree) = function_args_iter_cond(¶meter_type);
 | 
			
		||||
 | 
			
		||||
            if (definition->body != nullptr)
 | 
			
		||||
            {
 | 
			
		||||
                this->symbols->enter(parameter->identifier, declaration_tree);
 | 
			
		||||
                this->symbols->enter(*parameter_name, declaration_tree);
 | 
			
		||||
            }
 | 
			
		||||
            argument_chain = chainon(argument_chain, declaration_tree);
 | 
			
		||||
            function_args_iter_next(¶meter_type);
 | 
			
		||||
            ++parameter_name;
 | 
			
		||||
        }
 | 
			
		||||
        DECL_ARGUMENTS(fndecl) = argument_chain;
 | 
			
		||||
        TREE_PUBLIC(fndecl) = definition->exported;
 | 
			
		||||
@@ -779,15 +780,14 @@ namespace gcc
 | 
			
		||||
 | 
			
		||||
        for (std::size_t i = 0; i < type.parameters.size(); ++i)
 | 
			
		||||
        {
 | 
			
		||||
            boot::type_expression& parameter_type = type.parameters.at(i)->variable_type();
 | 
			
		||||
            parameter_type.accept(this);
 | 
			
		||||
            type.parameters.at(i)->accept(this);
 | 
			
		||||
            parameter_types[i] = this->current_expression;
 | 
			
		||||
        }
 | 
			
		||||
        tree return_type = void_type_node;
 | 
			
		||||
 | 
			
		||||
        if (type.return_type != nullptr)
 | 
			
		||||
        if (type.return_type.type != nullptr)
 | 
			
		||||
        {
 | 
			
		||||
            type.return_type->accept(this);
 | 
			
		||||
            type.return_type.type->accept(this);
 | 
			
		||||
            return_type = this->current_expression;
 | 
			
		||||
        }
 | 
			
		||||
        this->current_expression = NULL_TREE;
 | 
			
		||||
@@ -1226,4 +1226,3 @@ namespace gcc
 | 
			
		||||
        defer(leave_scope());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -24,9 +24,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
#include "fold-const.h"
 | 
			
		||||
#include "diagnostic-core.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace gcc
 | 
			
		||||
namespace elna::gcc
 | 
			
		||||
{
 | 
			
		||||
    bool is_pointer_type(tree type)
 | 
			
		||||
    {
 | 
			
		||||
@@ -210,4 +208,3 @@ namespace gcc
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -21,11 +21,10 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <variant>
 | 
			
		||||
#include "elna/boot/result.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace boot
 | 
			
		||||
namespace elna::boot
 | 
			
		||||
{
 | 
			
		||||
    enum class binary_operator
 | 
			
		||||
    {
 | 
			
		||||
@@ -379,10 +378,15 @@ namespace boot
 | 
			
		||||
    /**
 | 
			
		||||
     * Tags a procedure type as never returning.
 | 
			
		||||
     */
 | 
			
		||||
    struct no_return_t
 | 
			
		||||
    struct return_declaration
 | 
			
		||||
    {
 | 
			
		||||
        return_declaration() = default;
 | 
			
		||||
        explicit return_declaration(std::shared_ptr<type_expression> type);
 | 
			
		||||
        explicit return_declaration(std::monostate);
 | 
			
		||||
 | 
			
		||||
        std::shared_ptr<type_expression> type{ nullptr };
 | 
			
		||||
        bool no_return{ false };
 | 
			
		||||
    };
 | 
			
		||||
    constexpr no_return_t no_return{};
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Procedure type.
 | 
			
		||||
@@ -390,18 +394,14 @@ namespace boot
 | 
			
		||||
    class procedure_type_expression : public type_expression
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        const std::shared_ptr<type_expression> return_type;
 | 
			
		||||
        const bool no_return;
 | 
			
		||||
        std::vector<variable_declaration *> parameters;
 | 
			
		||||
        const return_declaration return_type;
 | 
			
		||||
        std::vector<std::shared_ptr<type_expression>> parameters;
 | 
			
		||||
 | 
			
		||||
        procedure_type_expression(const struct position position,
 | 
			
		||||
                std::shared_ptr<type_expression> return_type = nullptr);
 | 
			
		||||
        procedure_type_expression(const struct position position, no_return_t);
 | 
			
		||||
                return_declaration return_type = return_declaration());
 | 
			
		||||
 | 
			
		||||
        void accept(parser_visitor *visitor);
 | 
			
		||||
        std::shared_ptr<procedure_type_expression> is_procedure() override;
 | 
			
		||||
 | 
			
		||||
        virtual ~procedure_type_expression() override;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -413,6 +413,7 @@ namespace boot
 | 
			
		||||
 | 
			
		||||
    public:
 | 
			
		||||
        block *const body;
 | 
			
		||||
        std::vector<std::string> parameter_names;
 | 
			
		||||
 | 
			
		||||
        procedure_definition(const struct position position, const std::string& identifier,
 | 
			
		||||
                const bool exported, std::shared_ptr<procedure_type_expression> heading, block *body = nullptr);
 | 
			
		||||
@@ -840,4 +841,3 @@ namespace boot
 | 
			
		||||
 | 
			
		||||
    const char *print_binary_operator(const binary_operator operation);
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -21,9 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
#include "elna/boot/ast.h"
 | 
			
		||||
#include "location.hh"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace boot
 | 
			
		||||
namespace elna::boot
 | 
			
		||||
{
 | 
			
		||||
    position make_position(const yy::location& location);
 | 
			
		||||
 | 
			
		||||
@@ -50,4 +48,3 @@ namespace boot
 | 
			
		||||
 | 
			
		||||
    char escape_char(char escape);
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -22,9 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
#include <deque>
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace boot
 | 
			
		||||
namespace elna::boot
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Position in the source text.
 | 
			
		||||
@@ -82,4 +80,3 @@ namespace boot
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -24,9 +24,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
#include "elna/boot/result.h"
 | 
			
		||||
#include "elna/boot/symbol.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace boot
 | 
			
		||||
namespace elna::boot
 | 
			
		||||
{
 | 
			
		||||
    class undeclared_error : public error
 | 
			
		||||
    {
 | 
			
		||||
@@ -68,4 +66,3 @@ namespace boot
 | 
			
		||||
        void visit(procedure_type_expression *) override;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,9 +23,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace boot
 | 
			
		||||
namespace elna::boot
 | 
			
		||||
{
 | 
			
		||||
    class alias_type;
 | 
			
		||||
    class primitive_type;
 | 
			
		||||
@@ -257,4 +255,3 @@ namespace boot
 | 
			
		||||
 | 
			
		||||
    std::shared_ptr<symbol_table> builtin_symbol_table();
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -25,11 +25,8 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
 | 
			
		||||
#include "elna/gcc/elna-tree.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace gcc
 | 
			
		||||
namespace elna::gcc
 | 
			
		||||
{
 | 
			
		||||
    void init_ttree();
 | 
			
		||||
    std::shared_ptr<symbol_table> builtin_symbol_table();
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -29,12 +29,9 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
 | 
			
		||||
#include "elna/boot/result.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace gcc
 | 
			
		||||
namespace elna::gcc
 | 
			
		||||
{
 | 
			
		||||
    location_t get_location(const boot::position *position);
 | 
			
		||||
    std::string print_type(tree type);
 | 
			
		||||
    void report_errors(const std::deque<std::unique_ptr<boot::error>>& errors);
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,9 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace gcc
 | 
			
		||||
namespace elna::gcc
 | 
			
		||||
{
 | 
			
		||||
    std::deque<std::unique_ptr<boot::error>> do_semantic_analysis(const char *path,
 | 
			
		||||
            std::unique_ptr<boot::program>& ast, std::shared_ptr<boot::symbol_table> info_table,
 | 
			
		||||
@@ -104,4 +102,3 @@ namespace gcc
 | 
			
		||||
        void visit(boot::defer_statement *statement) override;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -29,9 +29,7 @@ along with GCC; see the file COPYING3.  If not see
 | 
			
		||||
#include "elna/boot/ast.h"
 | 
			
		||||
#include "elna/boot/symbol.h"
 | 
			
		||||
 | 
			
		||||
namespace elna
 | 
			
		||||
{
 | 
			
		||||
namespace gcc
 | 
			
		||||
namespace elna::gcc
 | 
			
		||||
{
 | 
			
		||||
    using symbol_table = boot::symbol_map<tree, tree, NULL_TREE>;
 | 
			
		||||
 | 
			
		||||
@@ -82,4 +80,3 @@ namespace gcc
 | 
			
		||||
            tree_code operator_code, tree left, tree right);
 | 
			
		||||
    tree build_field(location_t location, tree record_type, const std::string name, tree type);
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -88,9 +88,9 @@ type
 | 
			
		||||
    position: Position
 | 
			
		||||
 | 
			
		||||
	input: ^Byte
 | 
			
		||||
	empty: proc(data: ^Byte) -> Bool
 | 
			
		||||
	advance: proc(data: ^Byte)
 | 
			
		||||
	head: proc(data: ^Byte) -> Char
 | 
			
		||||
	empty: proc(^Byte) -> Bool
 | 
			
		||||
	advance: proc(^Byte)
 | 
			
		||||
	head: proc(^Byte) -> Char
 | 
			
		||||
  end
 | 
			
		||||
  Token* = record
 | 
			
		||||
    kind: Int
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user