Function strlen(PointerToCharacter str) Which Returns Integer32 Does
Return ValueAt(str)=0?0:1+strlen(str+1);
EndFunction
Structure Point Consists Of
Decimal32 x, y, z;
EndStructure
Function main() Which Returns Integer32 Does
InstantiateStructure Point myPoint;
Return strlen(TypeOf(AddressOf(myPoint)));
EndFunction
Running the tests...
All the tests passed in 8 milliseconds.
Reading the file "debug.aec"...
All characters read in 0 milliseconds.
Tokenizing the program...
Finished tokenizing the program in 0 milliseconds.
I have made a forum thread about how to speed up the tokenizer,
in case you are interested:
https://www.forum.hr/showthread.php?t=1243509
Parsing the program...
Finished parsing the program in 0 milliseconds.
Compiling the program...
Line 11, Column 18, Internal compiler error: A pointer to the string "PointPointer" is being attempted to compile before the string itself has been compiled, aborting the compilation!
Internal compiler error: Uncaught exception in the compiler: class CorruptCompilationContextException: Corrupt compilation context!
The JSON of the compilation context, at the time of throwing that exception, was:
{
"stackSize":4096,
"globalVariablePointer":4272,
"variableTypes":[
{
"first":"\"Character\"",
"second":"CharacterPointer"
},
{
"first":"\"CharacterPointer\"",
"second":"CharacterPointer"
},
{
"first":"\"Decimal32\"",
"second":"CharacterPointer"
},
{
"first":"\"Decimal32Pointer\"",
"second":"CharacterPointer"
},
{
"first":"\"Decimal64\"",
"second":"CharacterPointer"
},
{
"first":"\"Decimal64Pointer\"",
"second":"CharacterPointer"
},
{
"first":"\"Integer16\"",
"second":"CharacterPointer"
},
{
"first":"\"Integer16Pointer\"",
"second":"CharacterPointer"
},
{
"first":"\"Integer32\"",
"second":"CharacterPointer"
},
{
"first":"\"Integer32Pointer\"",
"second":"CharacterPointer"
},
{
"first":"\"Integer64\"",
"second":"CharacterPointer"
},
{
"first":"\"Integer64Pointer\"",
"second":"CharacterPointer"
},
{
"first":"\"Nothing\"",
"second":"CharacterPointer"
},
{
"first":"\"Point\"",
"second":"CharacterPointer"
},
{
"first":"myPoint",
"second":"Point"
}
],
"placesOfVariableDeclarations":[
{
"first":"myPoint",
"second":10
}
],
"globalVariables":[
{
"first":"\"Character\"",
"second":4096
},
{
"first":"\"CharacterPointer\"",
"second":4106
},
{
"first":"\"Decimal32\"",
"second":4123
},
{
"first":"\"Decimal32Pointer\"",
"second":4133
},
{
"first":"\"Decimal64\"",
"second":4150
},
{
"first":"\"Decimal64Pointer\"",
"second":4160
},
{
"first":"\"Integer16\"",
"second":4177
},
{
"first":"\"Integer16Pointer\"",
"second":4187
},
{
"first":"\"Integer32\"",
"second":4204
},
{
"first":"\"Integer32Pointer\"",
"second":4214
},
{
"first":"\"Integer64\"",
"second":4231
},
{
"first":"\"Integer64Pointer\"",
"second":4241
},
{
"first":"\"Nothing\"",
"second":4258
},
{
"first":"\"Point\"",
"second":4266
}
],
"localVariables":[
{
"first":"myPoint",
"second":12
}
],
"functions":[
{
"name":"strlen(",
"returnType":"Integer32",
"argumentTypes":["CharacterPointer"],
"defaultArgumentValues":[0.000000],
"argumentNames":["str"]
},
{
"name":"main(",
"returnType":"Integer32",
"argumentTypes":[],
"defaultArgumentValues":[],
"argumentNames":[]
}
],
"stackSizeOfThisFunction":12,
"stackSizeOfThisScope":12,
"currentFunctionName":"main(",
"structures":[
{
"name":"Point",
"sizeInBytes":12,
"memberNames":["x","y","z"],
"memberTypes":[
{
"first":"x",
"second":"Decimal32"
},
{
"first":"y",
"second":"Decimal32"
},
{
"first":"z",
"second":"Decimal32"
}
],
"memberOffsetInBytes":[
{
"first":"x",
"second":0
},
{
"first":"y",
"second":4
},
{
"first":"z",
"second":8
}
],
"defaultValuesOfMembers":[
{
"first":"x",
"second":0.000000
},
{
"first":"y",
"second":0.000000
},
{
"first":"z",
"second":0.000000
}
],
"arraySize":[
{
"first":"x",
"second":1
},
{
"first":"y",
"second":1
},
{
"first":"z",
"second":1
}
]
}
],
"structureSizes":[
{
"first":"Point",
"second":12
}
]
}
If you have time, please report this to me on GitHub as an issue:
https://github.com/FlatAssembler/AECforWebAssembly/issues
Given the way the compiler is structured, there doesn't seem to be a simple solution.
So, for example, this program:
That program crashes the compiler, with this error message:
Given the way the compiler is structured, there doesn't seem to be a simple solution.