https://github.com/msm-code/pseudobf
https://github.com/msm-code/pseudobf
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/msm-code/pseudobf
- Owner: msm-code
- Created: 2014-07-03T01:29:38.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-07-05T00:55:14.000Z (over 11 years ago)
- Last Synced: 2025-02-17T15:52:11.814Z (11 months ago)
- Language: C#
- Size: 930 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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