Posted 21 December 2016 - 10:05 PM
BrainF Compiler / Interpreter
Version 1.0
Version 1.0
I made this neat little program that can compile or interpret (depending on whether or not you intend on string.dump'ing it into a file) brainf. By compiling I mean turning it into raw Lua bytecode. You could technically string.dump the interpreter's function but it'd be a ridiculous file size comparatively.
(BrainF is a censored version of the intended language name, but since this forum is PG in nature, I should keep it in this manner.)
Note: When you click away from this site, the language will no longer be censored.
This project is hosted on Github and you can find it over here. If you want the raw code for the brainf compiler from pastebin, you can grab that here.
What is the practicality of this?
None intended. This is a proof-of-concept that it can be done with other languages, step by step, hopefully leading on to some more… menacing languages that I intend to eventually get working on.
How do I get this?
You scrolled past it. See the links "over here" and "that here"? Click one of those. If you want a quick pastebin link:
pastebin get tWfePq7M brainf
"This doesn't work with CC!"
I unfortunately cannot directly test with ComputerCraft due to my system limitations (cannot run Minecraft / emulators aren't guaranteed to reflect the exact experience brought by CC.) If you have any issues, please report them to the Github issues page over here. The only issue I will not say I will be able to fix is bytecode related things, such as string.dump. Bytecode does not work all of the time with ComputerCraft and will likely never. As of such, I must leave a disclaimer that byte code related features may or may not work.
Do you have any screenshots?
None in-game, but I have the next best thing.
Spoiler
Below is the compiled version of ",[>+.<-]" Which essentially takes your input, then tells you every ASCII letter before it.
Thank you for reading, if you have any feedback, negative or positive, please leave it in the replies. Hope to see if this works 100% with CC on Minecraft. Not going to bother testing the .load function as it will likely bug out due to some unforeseen differences between LuaJ and plain Lua.
Edited on 22 December 2016 - 01:22 AM