An interpreter and compiler Brainfuck under Java VM. It is written entirely in Java, Brainfuck source code can be interpreted in its VM or compiled into bytecode JVM, which optimizes and accelerates through JIT. If you are familiar with the projects JRuby, Jython, etc., then JBrainfuck is the same, only for Brainfuck.
- Interpretation
- Compiling under JVM, execution and saved in "class file".
- JIT (acceleration to 8x)
- Optimization (minimize multiple operations and replacement typical)
- Translation Brainfuck code to Java and C++
- Other options (replacement for the standard I/O and memory size)
//Hello World!
String code =
"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.++++++" +
"+..+++.>++.<<+++++++++++++++. >.+++.------.--------.>+.>.";
Compiler compiler = new Compiler(code, true);
VirtualMachine vm = compiler.compile();
vm.run();
- Java Compiler - class to compile BrainFuck on the JVM
- BF Compiler - class to compile BrainFuck under its own VM
- VirtualMachine - class execution results compilation Java Compiler or BF Compiler
- Settings - stores in itself global setting the memory size and I/O variables
- Translator - translator BrainFuck to Java and C++
ΠΡΠΎ ΠΈΠ½ΡΠ΅ΡΠΏΡΠ΅ΡΠ°ΡΠΎΡ ΠΈ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΎΡ ΡΠ·ΡΠΊΠ° Brainfuck ΠΏΠΎΠ΄ Java VM. ΠΠ½ ΠΏΠΎΠ»Π½ΠΎΡΡΡΡ ΡΠ°Π±ΠΎΡΠ°Π΅Ρ Π½Π° Java, ΠΈΡΡ ΠΎΠ΄Π½ΡΠΉ ΠΊΠΎΠ΄ Brainfuck ΠΌΠΎΠΆΠ΅Ρ Π±ΡΡΡ ΠΏΡΠΎΠΈΠ½ΡΠ΅ΡΠΏΡΠ΅ΡΠΈΡΠΎΠ²Π°Π½ Π² ΡΠ²ΠΎΠ΅ΠΉ VM ΠΈΠ»ΠΈ ΠΆΠ΅ ΡΠΊΠΎΠΌΠΏΠΈΠ»ΠΈΡΠΎΠ²Π°Π½ Π² Π±Π°ΠΉΡΠΊΠΎΠ΄ JVM, ΠΊΠΎΡΠΎΡΡΠΉ ΠΏΠΎΠ΄Π²Π΅ΡΠ³Π°Π΅ΡΡΡ ΠΎΠΏΡΠΈΠΌΠΈΠ·Π°ΡΠΈΡΠΌ ΠΈ JIT. ΠΡΠ»ΠΈ Π²Ρ Π·Π½Π°ΠΊΠΎΠΌΡ Ρ ΠΏΡΠΎΠ΅ΠΊΡΠ°ΠΌΠΈ JRuby, Jython ΠΈ Ρ.Π΄., ΡΠΎ JBrainfuck ΡΡΠΎ ΡΠΎΠΆΠ΅ ΡΠ°ΠΌΠΎΠ΅, ΡΠΎΠ»ΡΠΊΠΎ Π΄Π»Ρ Brainfuck.
- ΠΠ½ΡΠ΅ΡΠΏΡΠ΅ΡΠ°ΡΠΈΡ
- ΠΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΡ ΠΏΠΎΠ΄ JVM, Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΠΈ ΡΠΎΡ ΡΠ°Π½ΠΈΠ΅ Π² class ΡΠ°ΠΉΠ».
- JIT (Π΄ΠΎ 8 ΡΠ°Π· Π±ΡΡΡΡΠ΅Π΅ ΠΎΠ±ΡΡΠ½ΠΎΠΉ ΠΈΠ½ΡΠ΅ΡΠΏΡΠ΅ΡΠ°ΡΠΈΠΈ)
- ΠΠΏΡΠΈΠΌΠΈΠ·Π°ΡΠΈΠΈ (ΡΠ²ΠΎΡΠ°ΡΠΈΠ²Π°Π½ΠΈΠ΅ ΠΌΠ½ΠΎΠΆΠ΅ΡΡΠ²Π΅Π½Π½ΡΡ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΉ ΠΈ Π·Π°ΠΌΠ΅Π½Π° ΡΠΈΠΏΠΈΡΠ½ΡΡ )
- Π’ΡΠ°Π½ΡΠ»ΡΡΠΈΡ ΠΊΠΎΠ΄Π° Brainfuck Π½Π° ΡΠ·ΡΠΊΠΈ Java ΠΈ C++
- ΠΡΡΠ³ΠΈΠ΅ ΠΎΠΏΡΠΈΠΈ (Π·Π°ΠΌΠ΅Π½Π° ΡΡΠ°Π½Π΄Π°ΡΡΠ½ΠΎΠ³ΠΎ Π²Π²ΠΎΠ΄Π°/Π²ΡΠ²ΠΎΠ΄Π° ΠΈ ΡΠ°Π·ΠΌΠ΅Ρ ΠΏΠ°ΠΌΡΡΠΈ)
//Hello World!
String code =
"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.++++++" +
"+..+++.>++.<<+++++++++++++++. >.+++.------.--------.>+.>.";
Compiler compiler = new Compiler(code, true);
VirtualMachine vm = compiler.compile();
vm.run();
- Java Compiler - ΠΊΠ»Π°ΡΡ Π΄Π»Ρ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ BrainFuck ΠΏΠΎΠ΄ JVM
- BF Compiler - ΠΊΠ»Π°ΡΡ Π΄Π»Ρ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ BrainFuck ΠΏΠΎΠ΄ ΠΎΠ±ΡΡΠ½ΡΡ VM
- VirtualMachine - ΠΊΠ»Π°ΡΡ Π΄Π»Ρ Π·Π°ΠΏΡΡΠΊΠ° ΡΠ΅Π·ΡΠ»ΡΡΠ°ΡΠ° ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ Java Compiler ΠΈΠ»ΠΈ BF Compiler
- Settings - Ρ ΡΠ°Π½ΠΈΡ Π² ΡΠ΅Π±Π΅ Π³Π»ΠΎΠ±Π°Π»ΡΠ½ΡΠ΅ Π½Π°ΡΡΡΠΎΠΉΠΊΠΈ ΡΠ°Π·ΠΌΠ΅ΡΠ° ΠΏΠ°ΠΌΡΡΠΈ ΠΈ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅ Π²Π²ΠΎΠ΄Π°/Π²ΡΠ²ΠΎΠ΄Π°
- Translator - ΡΡΠ°Π½ΡΠ»ΡΡΠΎΡ BrainFuck Π½Π° ΡΠ·ΡΠΊΠΈ Java ΠΈ Π‘++