Log In  

Hi, I just released Depicofier, which converts PICO-8's syntax to regular Lua syntax. I looked at a couple existing solutions but they didn't work for me, so I made this. It's open source under the MIT license on Github.

It should be feature complete, but if I missed anything please let me know.


Converts/translates PICO-8 style Lua syntax to standard clean Lua syntax. Download the latest release here.

This tool uses a publicly available and well-tested Lua language grammar to parse PICO-8 source code, so that any enhanced or special syntax or shorthand will only be converted where it should be.

If you like this tool please consider kicking me a dollar on Patreon.


Depicofier.exe [inFile] [outFile]
Or to output source to console:
Depicofier.exe [inFile] -print
-strict   Print warnings for Lua syntax not found in Pico 8 such as binary
          operators, integer division, and bitwise shifts
P#66019 2019-07-22 03:14

Interesting approach. The PICO-8 specializations are all implemented internally as a line-based preprocessing step and have line-based behaviors. Is it possible to implement line endings in these grammars? (I notice it doesn't do short-ifs yet.)

Other implementations, for comparison:

Cool to see an increased interest in using Lua processing tools with PICO-8!

P#66022 2019-07-22 07:08

It does do short-ifs and the print shorthand, but I realized it would be extremely hard to implement in the Lua grammar via ANTLR, because it cares about line endings and Lua's grammar does not. Instead I process those two cases line-by-line. I still use the Lua grammar for them, but I only look at tokens for them.

I had issues with what appeared to be if shorthand edge cases in picotool's --pure-lua flag. I'm sure with time those'll be solved but it was easier for me to create my own than try and figure out where picotool's parser was going wrong for me.

I also looked at pico8-to-lua, but noticed it uses regex so it has no context awareness, which made me incredibly nervous about using it.

P#66023 2019-07-22 08:05

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-02-02 12:24:55 | 0.006s | Q:11