Hello there,
For a long while I wanted to learn more about Lua bytecode and thought it would be really useful to quickly see the produced bytecode for code real-time. I thought about contributing to godbolt.org, however in the end decided to create a separate system so that I wouldn't be limited by an existing system.
luac.nl - a simple website with an editor and (currently) up to three output panes. Each output pane shows the bytecode output for the Lua source code real-time and tries to explain each instruction when hovering over their names. All Lua versions from 4 through 5.4 are supported, however the decoding of Lua 4 instructions is not complete.
please note that there is going to be bugs, this is a beta
https://luac.nl
features
- real-time dumping of Lua code in any supported version;
- use the 32-bit or 64-bit version of luac in the back-end, which might be useful to spot issues in development versions of Lua;
- syntax highlighting of both the Lua source code and the bytecode output;
- when a line is selected in either source or output panes, all matching lines are selected in all panes;
- function signatures in bytecode output panes;
- navigating functions in bytecode output panes by clicking on their signature in the instruction comment;
- collapsible constants, locals and upvalues tables for each function;
- constants, locals and upvalues for Lua versions that don't fully list them through luac;
- code is immediately deleted after analysis on the server, only when sharing code it is stored;
- sharing full sessions (code + output panes) by generating a link one can share, only at this point the code will be stored on my server;
- multiple sessions, all stored in localStorage. Sessions can be selected in the bottom panel of the editor;
- saving the produced .luac for each output panel to disk using the save button on each panel;
- dynamically add or remove output panels, dynamically change version and architecture.
future
- deleting sessions, currently the localStorage will have to be cleared for that (F12);
- Lua 4 instruction information that is correct;
- very probably a lot of bug fixes;
- whatever is suggested by users, if possible and within scope;
- a function tree showing the hierarchy of functions in bytecode, which is visible already on the simple variant at luac.nl/simple/ (the concept phase version, no editor);
- a new logo (the current one was the development logo, it's ugly.);
- a broader implementation of lfile (another project I will be open-sourcing eventually, file detection / recognition and analysis with Lua modules. I am currently using the lua type module I wrote for lfile to get additional information about bytecode that is not displayed in luac output.);
- auto-completion in the editor. I'm using CodeMirror, so this shouldn't be a big problem;
- when hovering over instructions that can jump, highlight the target pc.
I'm not sure if this is going to be useful to anyone, however feel free to give me feedback on this thread, through my Twitter handle @BGroothedde or direct contact on this address. I would also like to know if there are security issues I need to know about, I would appreciate if these could be sent to me directly if found so that I can fix them promptly.
Thank you and Happy Holidays, all be well!
Bas Groothedde Imagine Programming
|