What is the most absurd error message a program you have made was outputting?
June 11, 2023 at 9:51 am
Up until yesterday, my AEC-to-WebAssembly compiler was, if somebody tried to use two structures of different types as the second and the third operand to the `?:` (ternary conditional) operator (which is always wrong, but it has happened to me quite a few times that I accidentally tried to do it in C++), as in this example:
For that example, my AEC-to-WebAssembly compiler was outputting this error message:
Truly absurd, right? There are no arrays in the program, so how can a part of a compiler possibly request an array with a negative size? It took me hours to figure out what is going on in my compiler (Which perhaps shouldn't be surprising considering that I wrote it 3 years ago.).
Code:
Structure First Consists Of
Nothing;
EndStructure
Structure Second Consists Of
Nothing;
EndStructure
Function main(Integer32 a, Integer32 b) Which Returns Nothing Does
InstantiateStructure First firstStructure;
InstantiateStructure Second secondStructure;
InstantiateStructure Second thirdStructure := (a > b) ? firstStructure : secondStructure; // This line contains the error.
EndFunction
Code:
Running the tests...
All the tests passed in 4 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 10, Column 29, Internal compiler error: Some part of the compiler attempted to compile an array with size less than 1, which doesn't make sense. Throwing an exception!
Internal compiler error: Uncaught exception in the compiler: St13runtime_error: Compiling an array of negative size!
If you have time, please report this to me on GitHub as an issue:
https://github.com/FlatAssembler/AECforWebAssembly/issues