Skip to content

[BIG UPDATE] Refactor code formatting and remove unused bit module#217

Merged
levno-710 merged 3 commits intoprometheus-lua:masterfrom
SpinnySpiwal:master
Mar 23, 2026
Merged

[BIG UPDATE] Refactor code formatting and remove unused bit module#217
levno-710 merged 3 commits intoprometheus-lua:masterfrom
SpinnySpiwal:master

Conversation

@SpinnySpiwal
Copy link
Contributor

  • Cleaned up whitespace inconsistencies across multiple files.
  • Removed the unused 'bit' module from the project.
  • Updated comments and documentation for clarity.
  • REFACTORED SINGLE-FILE COMPILER! Replaced with behaviourally identical modularised version.
  • tested integrity of 'identical' using Vmify on seed 1 with NameGenerator set to Mangled.
  • Removed unused dependencies initialised in pipeline.lua.
  • Removed unused functions from util.lua previouslty used for compiler_old.
  • Fixed inconsistent whitespaces in steps.lua.
    NOTE: This makes maintenance to the compiler much easier, and allows significant security modifications in the future when needed, Given the deobfuscation rumours.

tldr: Refactored compiler while maintaining 1:1 behavioural profile fixed whitespacing issues and corrected file comments
Nice try deobfuscators. Not happening while I'm still around.

SpinnySpiwal and others added 3 commits March 21, 2026 20:49
- Cleaned up whitespace inconsistencies across multiple files.
- Removed the unused 'bit' module from the project.
- Updated comments and documentation for clarity.
- REFACTORED SINGLE-FILE COMPILER! Replaced with behaviourally identical modularised version.
- tested integrity of 'identical' using Vmify on seed 1 with NameGenerator set to Mangled.
- Removed unused dependencies initialised in pipeline.lua.
- Removed unused functions from util.lua previouslty used for compiler_old.
- Fixed inconsistent whitespaces in steps.lua.
NOTE: This makes maintenance to the compiler much easier, and allows significant security modifications in the future when needed, Given the deobfuscation rumours.
- Cleaned up whitespace inconsistencies across multiple files.
- Removed the unused 'bit' module from the project.
- Updated comments and documentation for clarity.
- REFACTORED SINGLE-FILE COMPILER! Replaced with behaviourally identical modularised version.
- tested integrity of 'identical' using Vmify on seed 1 with NameGenerator set to Mangled.
- Removed unused dependencies initialised in pipeline.lua.
- Removed unused functions from util.lua previouslty used for compiler_old.
- Fixed inconsistent whitespaces in steps.lua.
NOTE: This makes maintenance to the compiler much easier, and allows significant security modifications in the future when needed, Given the deobfuscation rumours.
@playvora
Copy link

its time to buy claude with max plan so it can rewrite the compiler to 100% accurate luraph vm like

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR primarily refactors and modularizes the Prometheus compiler implementation while also doing broad whitespace/formatting cleanup and removing an unused internal bitwise module.

Changes:

  • Removed the unused src/prometheus/bit.lua module and pruned related utilities from src/prometheus/util.lua.
  • Modularized the compiler into dedicated modules for blocks/registers/upvalues/emission, plus statement/expression handler tables.
  • Standardized whitespace/formatting across several core Prometheus modules and comments.

Reviewed changes

Copilot reviewed 49 out of 56 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests.lua Minor formatting cleanup in test harness configuration and output capture.
src/prometheus/util.lua Removes unused bit/packing helpers and tightens keys() implementation + exports.
src/prometheus/unparser.lua Whitespace-only formatting changes.
src/prometheus/tokenizer.lua Whitespace-only formatting changes.
src/prometheus/steps.lua Normalizes step table formatting (commas, alignment).
src/prometheus/step.lua Whitespace changes around settings validation logic.
src/prometheus/scope.lua Whitespace-only formatting changes.
src/prometheus/pipeline.lua Removes unused requires/locals and normalizes whitespace.
src/prometheus/parser.lua Removes unused local aliases and normalizes whitespace.
src/prometheus/enums.lua Whitespace-only formatting changes in conventions tables.
src/prometheus/compiler/upvalue.lua New: upvalue + GC/proxy/allocation helpers extracted into module.
src/prometheus/compiler/statements/while_statement.lua New: compiler handler for WhileStatement.
src/prometheus/compiler/statements/return.lua New: compiler handler for ReturnStatement.
src/prometheus/compiler/statements/repeat_statement.lua New: compiler handler for RepeatStatement.
src/prometheus/compiler/statements/pass_self_function_call.lua New: compiler handler for PassSelfFunctionCallStatement.
src/prometheus/compiler/statements/local_variable_declaration.lua New: compiler handler for LocalVariableDeclaration.
src/prometheus/compiler/statements/local_function_declaration.lua New: compiler handler for LocalFunctionDeclaration.
src/prometheus/compiler/statements/if_statement.lua New: compiler handler for IfStatement.
src/prometheus/compiler/statements/function_declaration.lua New: compiler handler for FunctionDeclaration.
src/prometheus/compiler/statements/function_call.lua New: compiler handler for FunctionCallStatement.
src/prometheus/compiler/statements/for_statement.lua New: compiler handler for ForStatement.
src/prometheus/compiler/statements/for_in_statement.lua New: compiler handler for ForInStatement.
src/prometheus/compiler/statements/do_statement.lua New: compiler handler for DoStatement.
src/prometheus/compiler/statements/continue_statement.lua New: compiler handler for ContinueStatement.
src/prometheus/compiler/statements/compound.lua New: shared compiler handler for compound assignment statements.
src/prometheus/compiler/statements/break_statement.lua New: compiler handler for BreakStatement.
src/prometheus/compiler/statements/assignment.lua New: compiler handler for AssignmentStatement.
src/prometheus/compiler/statements.lua New: AstKind→statement-handler dispatch table.
src/prometheus/compiler/register.lua New: register allocation/freeing + register read/write AST helpers.
src/prometheus/compiler/expressions/variable.lua New: expression handler for VariableExpression.
src/prometheus/compiler/expressions/vararg.lua New: expression handler for VarargExpression.
src/prometheus/compiler/expressions/table_constructor.lua New: expression handler for TableConstructorExpression.
src/prometheus/compiler/expressions/string.lua New: expression handler for StringExpression.
src/prometheus/compiler/expressions/pass_self_function_call.lua New: expression handler for PassSelfFunctionCallExpression.
src/prometheus/compiler/expressions/or.lua New: expression handler for OrExpression (short-circuit handling).
src/prometheus/compiler/expressions/number.lua New: expression handler for NumberExpression.
src/prometheus/compiler/expressions/not.lua New: expression handler for NotExpression.
src/prometheus/compiler/expressions/nil.lua New: expression handler for NilExpression.
src/prometheus/compiler/expressions/negate.lua New: expression handler for NegateExpression.
src/prometheus/compiler/expressions/len.lua New: expression handler for LenExpression.
src/prometheus/compiler/expressions/index.lua New: expression handler for IndexExpression.
src/prometheus/compiler/expressions/function_literal.lua New: expression handler for FunctionLiteralExpression.
src/prometheus/compiler/expressions/function_call.lua New: expression handler for FunctionCallExpression.
src/prometheus/compiler/expressions/boolean.lua New: expression handler for BooleanExpression.
src/prometheus/compiler/expressions/binary.lua New: shared handler for binary operator expressions.
src/prometheus/compiler/expressions/and.lua New: expression handler for AndExpression (short-circuit handling).
src/prometheus/compiler/expressions.lua New: AstKind→expression-handler dispatch table.
src/prometheus/compiler/emit.lua New: emits/shuffles container function blocks and builds dispatch while-body.
src/prometheus/compiler/constants.lua New: shared compiler constants (e.g., MAX_REGS).
src/prometheus/compiler/compiler.lua Refactors the compiler entrypoint to compose the new modules.
src/prometheus/compiler/compile_top.lua New: compilation of top node, functions, and blocks extracted into module.
src/prometheus/compiler/compile_core.lua New: compileStatement/compileExpression dispatch + wiring of top compilation.
src/prometheus/compiler/block.lua New: block creation/activation + statement recording extracted into module.
src/prometheus/bit.lua Removed: unused bitwise module implementation.
src/prometheus/ast.lua Whitespace-only formatting changes.
src/presets.lua Fixes incorrect file header comment label.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SpinnySpiwal
Copy link
Contributor Author

so what are we thinking? 👀

@SpinnySpiwal
Copy link
Contributor Author

i already aggressively tested it for bugs lmao it's all good

@levno-710
Copy link
Member

I also checked your code by hand. Looks good to me. Thank you for this work :)

@levno-710 levno-710 merged commit e05edf5 into prometheus-lua:master Mar 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants