I can never resist an opportunity to mess around with regular expressions, so here's my attempt at a code minimizing script.
https://github.com/centuryglass/phantasos/blob/master/minimize.pl
If you already have perl installed, you just need to run 'perl minimize.pl yourcode.p8'. It will output the minimized code to 'yourcode_min.p8". Token mappings are also saved as 'yourcode tokens.txt' to make debugging easier. I've only tested it with my game and a few random carts. Let me know if it doesn't work on your code, I'm sure there are a couple obscure reserved words and odd failure conditions I've missed.



Nice!
Prior art, for reference (not harshing your project): picotool has a full Lua parser with minifier, among other tools and libs. Python-based.
[Please log in to post a comment]