Zyxonia/Compile
Zyxonia uses a compiling system like C/C++.
How did it work?
It can roughly divided to 5 parts.
Part I: Clean
In the "clean" phase, Zyxonia deletes the comments and unused waste variables in the code, then expands all iteration containers generated by the iterative function and ignores all NOP instructions.
Part II: Preprocessing
In the "preprocessing" phase, Zyxonia replaces all the libraries in the code with the actual content, and then automatically configures the environment according to the command ENV <- xxx.
Part III: Compilation
In the "compilation" phase, Zyxonia will convert the processed code into assembly code. First, Zyxonia performs syntax analysis of the code, followed by semantic analysis. If one of the two analyses fails, the compilation terminates. If both analyses pass, the code is optimized to be more efficient, and then the assembly code is generated.
Part IV: Assemble
In the "assembly" phase, the assembler (usually Zyxonia Assembly) converts the assembly code into machine code, and then extracts the symbols (identifiers, including functions and subroutines and classes) from the source code and generates a table of symbols.
Part V: Link
In the Link phase, a linker (e.g. Zyxonia Linker) will connect one or more objects to the library. First, Zyxonia does symbol parsing, and then the symbol conflict is resolved. Then, each code and data will be assigned an address by the linker. Finally, the linker links the standard library or the third-party library into the executable file to complete the linking.
Example
Suppose there is a script named "Main.zyx".
Part I: Clean
We use Hydrica(which is a cleaner of Zyxonia) to clean our code, then generate "Main.xvl.zyx".
Part II: Preprocessing
Then, Zyxonia will generate preprocessed code "Main.g".
Part III: Compilation
Zyxonia has a compiler which named "Cangqiong(苍穹)", it compiles the code and generate "Main.asm".
Part IV: Assemble
When we have "Main.asm", then we can use Zyxonia Assembly to assemble it into "Main.obj". But I don't understand why Windows opens the obj file as a 3D object and tells me it can't be opened......
Part V: Link
Then, we link "Main.obj" into "Main.exe", then the program can run normally now!