Skip to content

Latest commit

 

History

History
187 lines (140 loc) · 7.33 KB

CHANGELOG.md

File metadata and controls

187 lines (140 loc) · 7.33 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Fixed

  • Local functions (e.g., local function f()end) are not converted to local variable assignments (e.g., local f=function()end), as they are not perfectly semantically equal.
  • In table constructors, use record-style fields ({a=1}) in place of expression-style fields ({['a']=1}) only then the key is a valid identifier. For example, {['foo/bar']=1} was getting converted to {foo/bar=1}, causing crash.
  • Functions with named and varargs crashed the parser (e.g. f=function(x,...)end).

1.4.0 - 2024-05-05

Added

  • Parallel processing: mutations and their costs are computed on several processes simultaneously. This results in approx. 2-3x faster packing of files. Parameter -q controls the processing queue length; this is the maximum number of solutions being explored simultaneously. Defaults to 12, but you can try increasing it if you have a lot of cores. -P controls the number of parallel processes in a pool, defaults to number of cores and can be usually left unchanged. -q1 -P1 is identical to the old behavior.
  • Reading PNG-carts and writing fake PNG-like carts. The advantage of PNG-like carts is that all data chunks can be compressed too, so can be useful for 512b
    • 64k intros. The disadvantage is that additional 16-bytes of headers are needed. Choose this output format with -fpng. The file ending is still .tic, but TIC-80 sees the magic bytes and detects them as PNGs.
  • Shuffling data chunks during packing. This works only with PNG-like carts, as only they support compressing the entire cart.
  • Loading .lua carts with multiple banks.
  • Command line parameter -s0 means iterate forever. Intermediate results are saved, as always. (#16)

Changed

  • The output format is defined with -f e.g. -flua, -fpng, -func, or -ftic. The -u and -l options have been DEPRECATED. If an output file is defined, pakettic tries guessing the desired output format based on the file extension of the output file.
  • Size optimized the code generated by --data-to-code: use :gmatch instead of string.gmatch

Fixed

  • When packing multiple files, the initial minification of subsequent files continued using variable names from where the previous files had stopped.
  • Parse error: note was parsed as not e

1.3.1 - 2024-01-09

Fixed

  • Parentheses are not needed when indexing calls e.g. (a()).foo can be a().foo
  • Parentheses are needed in string literal method calls e.g. in ("abc"):sub(2)
  • Parse error when --{ looks like subtraction followed negated table constant

1.3.0 - 2023-08-20

Added

  • Option --data-to-code (or just -d) that puts the data in hexadecimal strings in the code and adds a small stub to load the data in the string at right address
  • Option --no-load to disable using the load trick altogether. load'' is not entirely semantically identical to function()end, as the load'' cannot access local variables in the outer scope. However, this is such a rare occurrence that only disable it when absolutely necessary.

Changed

  • Parse errors report the offending line more accurately

Fixed

  • Printing function calls with a single table or string parameter
  • Local variables without immediate assignment crashed the parser
  • The initial minification used reserved keywords (in particular: or)
  • Handling carts with multiple CODE chunks
  • Variable names that started with or or and could give an parse error; for example, in x=1 orange=2 the first statement was parsed as x=1 or ange, followed by =1 which gave the parse error.
  • Escaping \r and \f in quoted string literals
  • -- { was not considered comment, even though it was not considered permutation block either
  • Add space between a numeral and following period when printing. For example, 1 ..2 (string concatenation) should not be printed as 1..2, as LUA then parses the beginning of it as floating point numeral 1.

1.2.0 - 2023-04-02

Added

  • Perform initial variable minification before starting optimization
  • Constant folding: constant integer expressions are evaluated by pakettic, in case they compresses better
  • More detailed reporting of the crunching results

Fixed

  • Spaces between tokens were not always printed even when needed
  • Hex numbers with fractional digits had the fractional digits printed in reverse
  • Hex numbers with an exponent raised an error when printed

Changed

  • The default compression level is now -z0; our benchmarking does not show significant advantage over -z2 (only 0.2% over the test corpus), yet it's almost 3 times slower. Use -z2 and higher only when you are desperate and absolutely need that last byte.

1.1.1 - 2023-02-03

Fixed

  • The operator precedence of ^ vs. unary operators was STILL wrong: it binds more strongly than unary to the operand on its left, but less strongly than unary to the operand on its right
  • Long comments should be delimited by --[[ and ]], not --[[ and --]]

1.1.0 - 2023-02-01

Added

  • Treat --![ and --!] as multiline comments, so one can have debug code in unpacked intro, which is not included in the packed version

Fixed

  • The operator precedence of ^ vs. unary operators was wrong
  • Numerals ending in . (e.g. "1.") gave parse error, but should be allowed

1.0.1 - 2023-01-02

Fixed

  • Parsing 'nil' gave an error.

1.0.0 - 2022-12-10

Fixed

  • Don't crash when optimizing carts without anything to mutate.
  • Don't crash when packing code with method calls e.g. "obj:f()" (there was a bug both in the code formatter and the optimizer).
  • Don't replace symbol "self", because it has a special meaning, so just to be safe.
  • Parse method definitions correctly: function a:m()end is syntactic sugar for a.m=function(self)end
  • Don't crash when formatting "do ... end" blocks
  • Local functions now parse and print correctly.

0.1.0 - 2022-12-08

Added

  • Reading TIC-80 carts (.lua & .tic)
  • LUA parser based on pyparsing
  • Local optimization algorithms (simulated annealing, late acceptance hill climbing & diversified late acceptance search) that mutate the source code, to see if it compresses better
  • Mutations include: variable shortening, flipping operators, reordering arithmetic, single vs. double quotes in strings, hexadecimals vs. decimals
  • Magic comments to allow reordering statements and trying alternative expressions