F0bes / gifscript

A GS packet transpiler.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

# gifscript, a GS packet transpiler.

View the examples directory for, well, examples.

Documentation is located [here](https://github.com/F0bes/gifscript/wiki)

## What problem does this solve?
At the moment, nothing really. It's just a little abstraction over writing gif
packets manually. I only started this project to learn how to write a lexer and
parser.
Eventually it would be interesting to create another frontend (lexer)
that takes in binary data and make this into a bidirectional transpiler.
This could end up being a nifty debug tool for PS2 GS development.

## Task List:
- Output to a file, not just stdout. (Done)
- Support more registers / modifiers.
- Macros inside of macros. (Done)
- Dynamic variables / arguments for macros, instead of just fixed xy offset.
- Fix memory leaks. Look into smart pointers for register allocation. (done)
- External variable support. Design is still under thought.
- Binary data backend.
- Support PACKED formats when available.
- Heuristic for REGLIST / AD precision problems.
- Move first PRIM into GIFTAG.(done)
- Optimizations? IE: cull writes to a register that has no side effects twice. (first pass system done)
- Handle super sized gif packets that require more than one packet.
- Errors needs to propagate back instead of continuing in an error state. (kind of done)

## Design Details
This may be incorrect by the time you read this. But here is the outline of how
gifscript works.

The frontend (gifscript.rl), powered by ragel, takes in the file data and tokenizes it.
The tokens then get sent to the parser (parser.y), powered by lemon.
The parser then communicates with the "machine" (great name, I know) which
handles gif blocks, macros and various state.
When it is time for the block to be emitted, the machine calls the current
backend, which contains the logic for how to represent the block in the output
format.

About

A GS packet transpiler.

License:MIT License


Languages

Language:C++ 70.9%Language:Ragel 18.2%Language:CMake 8.8%Language:Yacc 2.1%