An interpreted language for mostly scripting purposes or simulations. I use this project in my game to implement in-game programming. It can also generate Brainfuck code, because why not, and can also optimize functions into MSIL, or compile the whole script into a DynamicMethod.
Note
Currently it doesn't support serializing, so you can only execute the script. However, you can save the generated Brainfuck code.
BBLang [options...] source
-
--helpPrints some information about the program -
--verbosePrints some information about the compilation process -
--format formatSpecifies which generator to use. Supported formats arebytecode,brainfuckandassembly.
Warning
Brainfuck sometimes aint working.
Warning
Assembly 100% not working.
-
--debugLaunches the debugger screen (only avaliable on Windows) More info -
--output fileWrites the generated code to the specified file (this option only works for brainfuck) -
--throw-errorsCrashes the program whenever an exception thrown. This useful for me when debugging the compiler. -
--print-instructionsPrints the generated instructions before execution -
--print-memoryPrints the memory after execution -
--basepath directorySets the path where source files will be searched forusingstatements -
--dont-optimizeDisables all optimization -
--no-debug-infoDisables debug information generation (if you compiling into brainfuck, generating debug informations will take a lots of time) -
--stack-size sizeSpecifies the stack size -
--heap-size sizeSpecifies the heap size
Note
For brainfuck, if you specify zero the heap will not be initialized and wherever you try to access it, it will not compile.
Note
Because of how heap represented, its size can't be larger than 126.
--no-nullcheckDisables null check generation when dereferencing a pointer
using "https://raw.githubusercontent.com/BBpezsgo/Interpreter/master/StandardLibrary/System.Console.bbc";
PrintLine("hello, world");Without dependencies:
[External("stdout")]
void Print(char message);
void PrintLine(temp string message)
{
for (int i = 0; message[i]; i++)
{
Print(message[i]);
}
Print('\r');
Print('\n');
}
PrintLine("hello, world");/ExamplesExamples for using the project as a library./StandardLibraryPreimplemented functions and structures and some "external function" declarations./TestFilesTest files I use for testing./SourceThe core functionality./UtilityThe command line interface./DebuggerA terminal based debugger.
Note
With .NET 9 this is already installed.
- Core
- Debugger
- CommandLineParser
- Core
- Import the
/Unity/package.jsonto the Unity project. - Make sure to make a symlink to the Sources directory. Run this inside the
/Unitydirectory:
ln -s ../Source RuntimeNote
If you are on Windows, move and rename the /Source directory to /Unity/Runtime.
- Inside Unity, naviage to
Edit > Project Settings... > Player > Other Settings > Scripting Define Symbolsand add theUNITYvariable. - If you are using the Burst compiler, add
UNITY_BURSTtoo. - If you are not using the Burst compiler, remove the
Unity.Burstreference from/Unity/BBLang.asmdef. - If you want some profiler analytics, add
UNITY_PROFILERtoo. - You can install the necessary NuGet packages with this tool: NuGetForUnity or import the dll-s manually.
install this