Parse pointer types

This commit is contained in:
2024-04-07 23:39:56 +02:00
parent 0876e25f90
commit 986bcdd0c7
11 changed files with 344 additions and 101 deletions

View File

@ -43,21 +43,28 @@ namespace elna::source
{
}
pointer_type::pointer_type(std::shared_ptr<const type> base_type, const std::size_t byte_size)
: type(byte_size), base_type(base_type)
{
}
symbol_table::symbol_table(std::shared_ptr<symbol_table> scope)
: outer_scope(scope)
{
if (scope == nullptr)
{
auto boolean_info = std::make_shared<type_info>(boolean_type);
auto int_info = std::make_shared<type_info>(int_type);
enter("Boolean", boolean_info);
enter("Int", int_info);
auto writei = std::make_shared<intrinsic_info>();
writei->parameter_infos.emplace_back(int_type);
writei->parameter_infos.emplace_back(int_info->type());
enter("writei", writei);
auto writeb = std::make_shared<intrinsic_info>();
writeb->parameter_infos.emplace_back(boolean_type);
writeb->parameter_infos.emplace_back(boolean_info->type());
enter("writeb", writeb);
enter("Boolean", std::make_shared<type_info>(boolean_type));
enter("Int", std::make_shared<type_info>(int_type));
}
}
@ -95,7 +102,7 @@ namespace elna::source
}
type_info::type_info(const class type& type)
: info(), m_type(type)
: info(), m_type(std::make_shared<class type>(type))
{
}
@ -103,7 +110,7 @@ namespace elna::source
{
}
const class type& type_info::type() const noexcept
std::shared_ptr<const class type> type_info::type() const noexcept
{
return m_type;
}
@ -122,7 +129,7 @@ namespace elna::source
return m_value;
}
variable_info::variable_info(const class type& type)
variable_info::variable_info(std::shared_ptr<const class type> type)
: m_type(type)
{
}
@ -131,12 +138,12 @@ namespace elna::source
{
}
const class type& variable_info::type() const noexcept
std::shared_ptr<const class type> variable_info::type() noexcept
{
return m_type;
}
parameter_info::parameter_info(const class type& type)
parameter_info::parameter_info(std::shared_ptr<const class type> type)
: m_type(type)
{
}
@ -145,7 +152,7 @@ namespace elna::source
{
}
const class type& parameter_info::type() const noexcept
std::shared_ptr<const class type> parameter_info::type() const noexcept
{
return m_type;
}