Skip to content

msm-code/PseudoBF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

PseudoBF

PseudoBF is simple language, that compiles to brainfuck itself. That is, you can write simple code similar to that:

function compare(varA, varB) {
     if (varA == varB) {
         print("equal. ");
     } else { 
         print("not equal. ");
     }
}

function main() : locals(a, b, c) {
    a = 7;

    print("Compare a to 5: ");
    compare(a, 5);

    print("Compare a to 7: ");
    compare(a, 7);
}

And feed it into PseudoBF compiler, to get equivalent code... In brainfuck!

>[-]+++++++>>>[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++.++++++++++++++++++++++++++++++++++++++++++++.--.+++.---------------.+++++++
++++++++++.-------------.-------------------------------------------------------
--------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.-----------------------------------------------------------------.+++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-----.--
-----------------------------------------------------------------------------.++
+++++++++++++++++++.+++++.--------------------------.>>>>[-]<<[-]<<<<<[>>>>>+>>+
<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-]<[-]+++++<<>>>[-]<<<[-]>[<+>>>+<<-]>>[<<+>>-][
-]>[-]<<<<[>>>>+<<<<-]+>>[>+>-<<-]>[<+>-]>[<<<<->>>>[-]]<[-]>[-]<<<<[>>>+>+<<<<-
]>>>[<<<+>>>-]+>[>[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++.++++++++++++.++++.-------------------
-.+++++++++++.--------------------------------------------------------------.---
-----------.<<->[-]]<[>>>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+.+++++.-------------
-----------------------------------------------------------------------.++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++.++++.
--------------------.+++++++++++.-----------------------------------------------
---------------.--------------.<<<-]<<<[-]++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++.++++++++++++++++++++++++++++++++++++++++++++.--.++
+.---------------.+++++++++++++++++.-------------.------------------------------
---------------------------------------.++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++.------------------------------------------------------
-----------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++.-----.---------------------------------------------------------
----------------------.+++++++++++++++++++++++.+++.--------------------------.>>
>>[-]<<[-]<<<<<<[>>>>>>+>>+<<<<<<<<-]>>>>>>>>[<<<<<<<<+>>>>>>>>-]<[-]+++++++<<>>
>[-]<<<[-]>[<+>>>+<<-]>>[<<+>>-][-]>[-]<<<<[>>>>+<<<<-]+>>[>+>-<<-]>[<+>-]>[<<<<
->>>>[-]]<[-]>[-]<<<<[>>>+>+<<<<-]>>>[<<<+>>>-]+>[>[-]++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++
++++++++.++++.--------------------.+++++++++++.---------------------------------
-----------------------------.--------------.<<->[-]]<[>>>[-]+++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++.+.+++++.------------------------------------------------------------
------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++.++++++++++++.++++.--------------------.+++++++++++.--------------
------------------------------------------------.--------------.<<<-]<<<<<<

After executing above code in any brainfuck interpreter, we get expected optput:

Compare a to 5: not equal. Compare a to 7: equal.

Note: this project is outdated. See also PseudoBF2 project, which is complete ground-up rewrite of this idea but better designed, more complete, and more extensible. https://github.com/msm-code/PseudoBF2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors