I’m trying to understand how all the basic types are are specified, in
order to understand the size of representation.
I have put here the components for uint8, and I want to make sure I
understand these.
My understanding is:
typedef uint8_t… ultimately enters uint8_t into the lexicon of types,
and that it will be the ultimate size in memory, because the code generator
will generate code with uint8_t
abst@ype atstkind_t0yte defines and abstract type, and its main purpose
is to denote a type that is non boxed
typedef tkind_t0ype (tk:tkind) converts the abstract type to a sort
’type’ for a non-boxed
g0uint_t0pe puts an abstract wrapper around kind_t0ype, but I am not sure
how it helps
typedef g1uint, g1uint0, g1uint1 each add constraints to the previous
abstract type via its alias
sortdef uint8 finally puts uint8 into the system as a sort
tkindef uint8_kind creates a kind/type that creates a type that is
connected to uint8_t so that the compiler can generate a uint8_t
uint8_0 passes the uint8_kind int u0uint so that now the compiler knows
the type is not boxed which I think means u0uint is a constructor of a type
constructing a type using uint8, which is a uint8_t
Finally we have more aliases for uint8 = uint8_1 _0, etc, which I assume
with uint8 defined multiple times, the compiler must be able to use context
to figure out which one applies
So I believe that ultimately, if I use uint8, it will generate uint8_t, and
that means addition of numbers resulting in a value larger than sizeof
uint8_t will overflow and wrap, if that is what the C compiler generated
machine code does. Therefore, we can reason about uint8 as if it were a
uint8_t.
Is my understanding of this correct?
Why go from type to abs to type again? I assume that abs is just an alias,
and type is of sort. But this just makes a lot of names and gets confusing.
What is the reason for such a rich vocabulary?
Yes, your understanding is right. The complexity you saw is mostly for supporting templates.------ Original message------From: Mike JonesDate: Fri, Oct 2, 2015 3:08 PMTo: ats-lang-users;Subject:Size of uint8 in memory
I’m trying to understand how all the basic types are are specified, in order to understand the size of representation.
I have put here the components for uint8, and I want to make sure I understand these.
My understanding is:
typedef uint8_t… ultimately enters uint8_t into the lexicon of types, and that it will be the ultimate size in memory, because the code generator will generate code with uint8_t
abst@ype atstkind_t0yte defines and abstract type, and its main purpose is to denote a type that is non boxed
typedef tkind_t0ype (tk:tkind) converts the abstract type to a sort ‘type’ for a non-boxed
g0uint_t0pe puts an abstract wrapper around kind_t0ype, but I am not sure how it helps
typedef g1uint, g1uint0, g1uint1 each add constraints to the previous abstract type via its alias
sortdef uint8 finally puts uint8 into the system as a sort
tkindef uint8_kind creates a kind/type that creates a type that is connected to uint8_t so that the compiler can generate a uint8_t
uint8_0 passes the uint8_kind int u0uint so that now the compiler knows the type is not boxed which I think means u0uint is a constructor of a type constructing a type using uint8, which is a uint8_t
Finally we have more aliases for uint8 = uint8_1 _0, etc, which I assume with uint8 defined multiple times, the compiler must be able to use context to figure out which one applies
So I believe that ultimately, if I use uint8, it will generate uint8_t, and that means addition of numbers resulting in a value larger than sizeof uint8_t will overflow and wrap, if that is what the C compiler generated machine code does. Therefore, we can reason about uint8 as if it were a uint8_t.
Is my understanding of this correct?
Why go from type to abs to type again? I assume that abs is just an alias, and type is of sort. But this just makes a lot of names and gets confusing. What is the reason for such a rich vocabulary?