File Formats
File Formats
Module File Format
Module File
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
byte[] |
MIR_FILE_MAGIC |
1 |
Name |
module name |
|
1 |
u128 |
module version |
|
1 |
int |
number of modules this module depends on n |
|
n |
ModuleRef |
reference to another module |
|
1 |
int |
number of DeclFeatures entries m |
|
m |
DeclFeatures |
features declared in this module |
1 |
ModuleRef
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
Name |
module name |
1 |
u128 |
module version |
DeclFeatures
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
outer feature index, 0 for outer==universe |
1 |
InnerFeatures |
inner Features |
InnerFeatures
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
sizeof(inner Features) |
1 |
Features |
Features
cond. | repeat | type | what |
---|---|---|---|
true |
n |
Feature |
(inner) Features |
Feature
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
short |
000000vvvFCYkkkk k = kind, Y = has Type feature (i.e., f.type), C = is intrinsic constructor, F = has fixed modifier, v = visibility |
Name |
name |
||
int |
arg count |
||
int |
name id |
||
Pos |
source code position |
||
int |
outer feature index, 0 for outer()==universe |
||
hasRT |
1 |
Type |
optional result type, hasRT = !isConstructor && !isChoice |
true NYI! !isField? !isIntrinsc |
1 |
int |
inherits count i |
i |
Code |
inherits calls |
|
true |
1 |
int |
precondition count pre_n |
pre_n |
Code |
precondition code |
|
1 |
int |
postcondition count post_n |
|
post_n |
Code |
postcondition code |
|
true |
1 |
int |
redefines count r |
r |
int |
feature offset of redefined feature |
|
isRoutine |
1 |
Code |
Feature code |
true |
1 |
InnerFeatures |
inner features of this feature |
Name
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
name length l |
l |
byte |
name as utf8 bytes |
Type
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
the kind of this type tk |
tk==-4 |
1 |
unit |
ADDRESS |
tk==-3 |
1 |
unit |
type of universe |
tk==-2 |
1 |
int |
index of type |
tk==-1 |
1 |
int |
index of type parameter feature |
tk>=0 |
1 |
int |
index of feature of type |
1 |
byte |
0: isValue, 1: isRef, 2: isThisType |
|
tk |
Type |
actual generics |
|
1 |
Type |
outer type |
Code
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
sizeof(Expressions) |
1 |
Expressions |
the actual code |
Expressions
cond. | repeat | type | what |
---|---|---|---|
true |
n |
Expression |
the single expressions |
Expression
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
byte |
ExprKind k in bits 0..6, hasPos in bit 7 |
hasPos |
1 |
int |
source position: index in this file’s SourceFiles section, 0 for builtIn pos |
k==Add |
1 |
Assign |
assignment |
k==Unb |
1 |
Unbox |
unbox expression |
k==Con |
1 |
Constant |
constant |
k==Cal |
1 |
Call |
feature call |
k==Mat |
1 |
Match |
match statement |
k==Tag |
1 |
Tag |
tag expression |
k==Env |
1 |
Env |
env expression |
Assign
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
assigned field index |
Unbox
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
Type |
result type |
1 |
bool |
needed flag (NYI: What is this? remove?) |
Constant
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
Type |
type of the constant |
length |
data length of the constant |
||
length |
byte |
data of the constant |
Call
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
called feature f index |
1 |
Type |
result type (NYI: remove, redundant!)s |
|
hasOpenArgList |
1 |
int |
num actual args (TBD: this is redundant, should be possible to determine) |
f.generics.isOpen |
1 |
int |
num actual generics n |
true |
n |
Type |
actual generics. if !hasOpen, n is f.generics().list.size() |
cf.resultType().isOpenGeneric() |
1 |
int |
select |
Match
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
number of cases |
n |
Case |
Case
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
num types n |
n = -1 |
1 |
int |
case field index |
n > 0 |
n |
Type |
case type |
true |
1 |
Code |
code for case |
Tag
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
Type |
resulting tagged union type |
Env
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
Type |
type of resulting env value |
SourceFiles
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
count n |
n |
SourceFile |
source file |
SourceFile
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
Name |
file name |
1 |
int |
size s |