kantord/emuto

idea: try testing generated code using a minifier

Open

#339 opened on Mar 17, 2019

 (0 comments) (0 reactions) (0 assignees)JavaScript (8 forks)github user discovery
good first issue

Repository metrics

Stars
 (223 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

As generating human-readable code is not a current aim, and we're quite far from having it anyway, it would make sense to generate a code that is already "minified". (i. e. cannot be reduced more by a minifier).

This might not be possible to achieve to 100% without implementing some complicated compiler logic (for example determining whether some parenthesis are needed). Implementing those should not be an aim in emuto, as we should try not to increase the compiler size, and if someone cares so much about the output being minified, they can still run a minifier on top of emuto.

As we already have a lot of code examples in interpreter.test.js, it would only make sense to utilize that test file to implement this, by adding a new test cases that uses a minifier internally to calculate what % of the output bytes were removed by the minified. The test should not fail the CI just yet, we'll get to actually improving the generated code after we have tests for it.

Contributor guide