GOOC - Game Oriented Object C
GOOC - Game Oriented Object C
4. The Parser
4. The Parser
The GOOC parser is the first step in converting a GOOC source code file into a GOOL executable file. It consists of a Flex-Bison program, located at ecsparse.l and ecsparse.y for the lexer and parser respectively. It takes a text input and a "parser state" structure, both also stored in global variables. The parser state structure serves as the context for the parser and will keep track of all the converted (so far) source code content.
The parser state keeps track of:
- The game version selected for compiling.
- The current instruction mode (MIPS or GOOL).
- The current MIPS stack adjustment necessary.
- A set of MIPS register status structures.
- A stack of saved GOOL variables, from save blocks.
- A stack of certain types of code blocks, such as if and while blocks.
- The code scope stack.
- The current subroutine being processed.
- The current state being processed.
- The current event interrupt being processed.
- The current state-subroutine being processed.
- The current animation descriptor being processed.
- The current array being processed.
- The current texture being processed.
- The current GOOL module for conversion.
- The main GOOL module for conversion.
- A list of GOOL module for conversion.
- A stack of include paths.
- Three functions for looking up certain data.
- The amount of spawns.
- The list of processed expression macros.
- Other minor functionality values, such as whether "temporary object fields" have been used already.