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 hash |
|
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 |
SourceFiles |
source code files |
ModuleRef
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
Name |
module name |
1 |
u128 |
module hash |
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 |
inner Features |
Features
cond. | repeat | type | what |
---|---|---|---|
true |
n |
Feature |
(inner) Features |
Feature
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
short |
0000REvvvFCYkkkk k = kind, Y = has Type feature (i.e., f.type), C = unused, F = has fixed modifier, v = visibility, R/E = has pre-/post-condition feature |
Name |
name |
||
int |
arg count |
||
int |
name id |
||
Pos |
source code position |
||
int |
outer feature index, 0 for outer()==null |
||
hasRT |
1 |
Type |
optional result type, hasRT = !isConstructor && !isChoice |
true NYI! !isField? !isIntrinsc |
1 |
int |
inherits count i |
i |
Code |
inherits calls |
|
R |
1 |
int |
feature offset of precondition feature |
1 |
int |
feature offset of precondition bool feature |
|
R && isConstructor |
1 |
int |
feature offset of precondition and call feature |
E |
1 |
int |
feature offset of postcondition feature |
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==Ass |
1 |
Assign |
assignment |
k==Con |
1 |
Constant |
constant |
k==Cal |
1 |
Call |
feature call |
k==Mat |
1 |
Match |
match expression |
k==Tag |
1 |
Tag |
tag expression |
k==Env |
1 |
Env |
env expression |
Assign
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
assigned field index |
Box
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
Type |
box result type |
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 |
InlineArray
cond. | repeat | type | what |
---|---|---|---|
true |
1 |
int |
size in fum |
true |
1 |
Code |
Code |
true |
1 |
int |
element count |
true |
n |
Code |
element |
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 |
|
s |
byte |
source file data |