-
Notifications
You must be signed in to change notification settings - Fork 0
About: flat.cpp
chris03-dev edited this page Sep 22, 2020
·
3 revisions
Note: The source code structure is not yet fully documented. A table of contents will be provided when it is done.
This file contains source code for compiling a .flat file into assembly. Many of these operations require functions from linemod.cpp.
In a nutshell, the code performs the following operations:
- Get the contents of an input file.
- Parse the contents to assembly code (in Intel syntax) in string streams.
- Insert the string streams, in order, to an assembly output file.
- Call the assembler to convert the output file to an executable binary.
Each operation will be explained in detail below...
-
Startup
-
Preprocessor loop (Read all Lines)
- Read line
- Remove comments on line
- Insert line to vector list
-
Parsing preparations
- Variable lists (Compiler Data)
- Vartype enum
-
Parsing loop (Convert lines to data for assembly code)
- Assembly flag
- Other
- Global variable declaration
- Function declaration
- Stack variable declaration
- Function call
- Arithmetic parsing
- Reserved keywords
-
Assembly file creation
- Assembly data section
- Assembly text section
-
End
- Build flathill
- Setup and use flathill
- Code using flathill
- Hello World
- Arithmetic
flat.cpplinemod.cppcompile-[win/nix].*