This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Admicos's profile picture

bfluac -- Convert bf programs to lua.

Started by Admicos, 18 July 2016 - 08:26 PM
Admicos #1
Posted 18 July 2016 - 10:26 PM
bfluac – convert bf to lua

HOW TO USE
[indent=1]bfluac.lua <file containing bf code> [extra arguments]
This will save the lua code to <filename>.bf.lua[/indent]

ARGUMENTS
[indent=1]-memLimit <number> allows you the set maximum value of a memory block (default 28-1)
-memBlocks <number> allows you the set how many memory blocks will be available for the program. Too low might cause crashes (default: 17)
-dbgSleep <number> how many seconds should the program wait before executing the next instruction (debug only) (default: 0.005)
+dbg enables debug mode for the program[/indent]

DOWNLOADS
[indent=1]9ymddf3E (pastebin) or admicos/bfluac (packman): bfluac[/indent]
[indent=1]b1m5khc0 (pastebin) or admicos/bfluac-helloworld (packman): hello world converted in bfluac (debug mode on and dbgSleep = 0.001)[/indent]

Also, the forum's WYSIWYG Editor might need some tweaking too
Edited on 22 July 2016 - 05:37 PM
bauen1 #2
Posted 19 July 2016 - 02:46 PM
Looks nice so far, there are some bugs tho:
It doesn't like programs with ]] or [[ or if they end with ]
Also there is loots of room for improvements (Check out the modulo % operator for wrapping)
And you could use "or 0" when accessing the tape so you don't need to preinitialize the tape

Oh and you have a very nice debug function :)/>
Admicos #3
Posted 19 July 2016 - 03:25 PM
Looks nice so far, there are some bugs tho:
It doesn't like programs with ]] or [[ or if they end with ]
Also there is loots of room for improvements (Check out the modulo % operator for wrapping)
And you could use "or 0" when accessing the tape so you don't need to preinitialize the tape

Oh and you have a very nice debug function :)/>
The ]] bug is fixed on the latest version, but it's not on pastebin. I just put it up (9ymddf3E)
I intentionally preinitialized the memory, but i might add a argument making it dynamic (dunno how it'll look on debug tho)