-
Notifications
You must be signed in to change notification settings - Fork 14
Home
RegPack is a packer for Javascript code, initially developed for js1k and mainly targeted at the demoscene for categories up to 4k.
RegPack is written in Javascript and can be run either from a browser or the CLI with Node.js.
This series of articles are the high-level design document for RegPack. They are a recommended read for :
- users willing to understand the inner clockwork and get the best from the tool,
- developers intending to contribute to the project.
When given a string as input, RegPack performs a series of operations to shorten its size. They can be split into two major phases :
Preprocessing refactors the code to optimize for size and prepare for the packer. The output of this phase is still valid Javascript that can be executed as-is and is semantically equivalent to the original input.
Packing performs lossless compression on the code, producing a string as output. It can only be executed after being unpacked : a short routine is appended that will decode it to the exact program that was provided as input.
Each phase comprises several steps (or modules), whose execution is not necessarily linear and may incur branching. This is detailed further in the upcoming pages.
This document was written from March 2016 on and covers RegPack up to version 5.0.x. Features for upcoming releases will be added along with the matching code base.