[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Here we are going to make Brainfuck better. The name would be

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 35
Thread images: 3

File: blankimage.png (397B, 100x100px) Image search: [Google]
blankimage.png
397B, 100x100px
Here we are going to make Brainfuck better.
The name would be Brainfuck++++ and [somebody draw the logo].
Let's not make it to look like C, Haskell, or Lisp, but let's make it a bit more readable but still Brainfuck.
We propose what would we want to implement.

And yes, Brainfuck++++ compiler should be compatible with Brainfuck code, so []+-.,>< are reserved.
The first thing - operation multiplying, let's write 4+ instead of ++++. Multiplying should work with +, -, <, >.
So, we have Hello world program.
Original Brainfuck:
++++++++
[>++++
[>++>+++>+++>+<<<<-]
>+>+>->>+[<]
<-]
>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.


Brainfuck++++

8+[>4+[>++>3+>3+>+4<-]>+>+>->>+[<]<-]>>.>3-.7+..3+.>>.<-.<.3+.6-.8-.>>+.>++.

Let's have fun!
>>
>>57254708
Lets have MFC support and call it Microsoft Visual Brainfuck
>>
Nah I'm too lazy.

The only thing that would make brainfuck more bearable is functions. That way, you can sorta nest programs on top of each other

There's no good way to do it with current functionality other than to have a program pre compile everything. Functions would allow basic "x*y" operations , and maybe we could even simulate object oriented programming
>>
Since Brainfuck operators are one-character originally, I think it would be better to do the same with operator multiplier - set values from 1 to 9 or 1 to F.

>>57254846
I think it would be better to make some B4 virtual machine.
Let's say, cells before 0 (BF programs start at 0 cell) would be some system parameters.

>>57254848
How about that:
S operator tells B4 to run the program from the cell, which number is stored in the current cell. After jumping to that cell, if runs program by taking values from cells, each command per cell.
The stop value is 0.
>>
>>57255130
Actually I have a better idea. Well two ideas

One involves simulating random access memory. But I think it'll stop being brainfuck after that. In total three operations are needed for functions to work goto, label, and to get the current position of the pointer.

One more, that's a little bit more interesting, in my opinion. It's a bit more recursive. Functions are defined by {/*code*/} and are in numeric order, and $ runs the function underneathe the pointer. The next element after that is how many parameters to enter in, and the next N elements are the parameters. Then another brainfuck interpreter is created with predefined elements that represent the N elements from before
>>
>>57255276
> But I think it'll stop being brainfuck after that
Kinda. I think we should remain inside Turing machine.

>Functions ... are in numeric order
I don't get that.

>$ runs the function underneathe the pointer. The next element after that is how many parameters to enter in, and the next N elements are the parameters. Then another brainfuck interpreter is created with predefined elements that represent the N elements from before

Let's say, we have n, n+1, n+2, n+3, n+4 cells.
Values are m, 3, 12, 34, 56.

Since m is a number of cell, we pass to the
m, m+1 and m+2 cells 12, 34 and 56 values.

Did I understand your idea?
>>
>>57255515
Let's say at the beginning of our program, we have such
{/*program 1*/}
{/*program 2*/}
{/*program 3*/}

If at any point in the rest of the program, we have $ then we launch the function underneath the pointer. For example, if the pointer has 1, we launch function 1
The number after that is the amount of parameters to include in that function. The numbers after that are the parameters

Then, in a new scope, we have a completely new array, initialized only with those parameters at the first, second, and third array. At any point in that function, we can use # to return that single variable underneath the pointer
>>
>>57255708
Alright, could you show me code example with ypur operator?
>>
>>57255812
I'm on my phone, so that's a bit harder. But I'll just copy and paste and hope my code works

{[->+<]>#} //adds two numbers together
+ // selects program one
>++ //sets two parameters
>+ // first parameter
>++ // second parameter
<<<$ // launches function

When it launches the function, it makes a new array with 1 as the first element and 2 is the next. As soon as it reaches #, we exit the scope. I guess after that, we can delete the four elements and replace it with 3 or maybe add it as the fifth element?
>>
>>57256024
> I guess after that, we can delete the four elements and replace it with 3 or maybe add it as the fifth element?
The simplest way would be just store returning way in the cell where we called the function.
It needs to be thought, how that's implementable in plain brainfuck though.
>>
>>57256188
I guess. But do we delete elements after? It would kinda suck having to clear them out manually
>>
File: forth_on_the_atari.jpg (62KB, 450x722px) Image search: [Google]
forth_on_the_atari.jpg
62KB, 450x722px
>>57254708
make it use reverse polish notation
>>
>>57256240
We may leave that to function authors.
# may be the pointer to the call cell, so we could flush other cells.
{[->+<]>#>[]>[]>[]<<<}
+
>++
>+
>++
<<<$

The value we return into the call cell is defined by value of the cell where we left the function.
>>
>>57256296
It doesn't have any binary operators
>>
Bump, very interesting but I am don't have the knowledge to participate
>>
>>57258029
I think you might want to study Turing machines.
>>
>>57258341
I understand Turing machines, I mean I am not familiar with BF. After reading for 10 seconds I feel silly
>>
>>57258385
> + - increment the value in cell by 1
> - - decrement the value in cell by 1
> > - go to the right by one cell
> < - go to the left by one cell
> . - print the value from the cell as ASCII character
> , - get the value into cell
> instructions inside [] are executed until the value of the current cell becomes zero

Now you can read BF.
>>
>>57254708
I think you guys are missing the point of brainfuck. You're trying to make a language more complex and usable even though it's supposed to be simple and near unusable.
>>
>>57258686
Well, that's really easy to fall into reimplementing of existing language.
Do I want to make BF complex? I don't. I'd want just to define a couple of macros, transformable into BF code by hand.
Do I want to make it usable? Yes, I want. I understand that the whole point of BF that every algorithm can be remade on the Turing machine, by nobody would want to. That's fun but what if would be a real deal?
I think: "The core of the BF is Turing machine, so if I want to expand, I should never touch the core." B4 should remain as the implementation of Turing machine, so everything we have to operate are still values in the cells and the pointer.
>>
>>57259197
Whoops, didn't fill the name field.

>>57255130
> I think it would be better to make some B4 virtual machine.
Continuing on that, we can think about . as about the common output operator.
It means if we want to, we must define, if we want output values as characters or as, let's say, pixels on the screen.
Should it be external option or it would be (obviously) better to make it as some internal option? If we want to make it internal, won't this hurt the whole idea of Turing machine?
>>
>>57259242
>>57259197
...Well, fuck.
>>
>>57254708
>make brainfuck more readable
You're missing the point.
>>
>>57260203
I'm interested in being brainfuck a usable language though.
>>
>>57261455
It is usable.
>>
>>57261462
Can I use Node.js with it?
>>
>>57261515
Yes. It can do anything C can, more efficiently.
>>
>>57261455
The point of Brainfuck was to create a turing complete language with as few operations as possible. You can even make it have less instructions, by relying on overflow, and thus remove < and - from the instruction set.
>>
>>57261535
iirc the point was to make a Turing complete language you could write a compiler for that was as simple as possible. The smallest compiler is 160 bites of c code
>>
>>57261535
If I wanted to remove instructions I'd have a "change operation" instruction.
>>
>>57261938

Guys I've made a new language. I call it ILL.
L = perform operation
I = change operation
operations:
0: increment
1: decrement
2: next cell
3: prev cell
4: print cell value as ascii
5: cell = ascii input
6: new loop
7: return to last unbroken loop and change op to 6, or nothing if current value 0
LLLLLLLL //++++++++
IIIIIILIIIILIIIIIILLLL //[>++++
IIIIIILIIIILIIIIIILLIILIIIIIILLLIILIIIIIILLLIILIIIIIILIIILLLLIIIIIILIIIIIIL //[>++>+++>+++>+<<<<-]
IIILIIIIIILIILIIIIIILIILIIIIIIILILLIIIIIILIIIIIILIIIIILIIIIL //>+>+>->>+[<]
IIIILIIIIIILIIIIIIL //<-]
IIILLIILIIIIIILIIIIIIILLLIIILIIIILLLLLLLIIIILLIIIILLLIIIILIIIIIILLIILIIIIIIILIIIIIILIIILIIIIILILIIIILLLIIIILIIIIILLLLLIIILIIIIILLLLLLLLIIILIIIIIILLIIIIIILIIIILIIIIIILIIIIIILLIIIIL //>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

Also I guess I should mention that case doesn't matter. New line characters are ignored, evidently.

Also since there are only 2 ops, it's reasonable to assume you can just turn it into binary. Taking 0=change and 1=perform, we get the ascii representation (bastardised by 4chan's filters)
ÿ<@ÈÈà@° A@8@È|Aþ `B 
>>
File: feelingILLyet.png (2KB, 605x30px) Image search: [Google]
feelingILLyet.png
2KB, 605x30px
>>57262318
some notes:
character count is no more than 7 times larger. This is absolute.
I'd expect about 3x the character count typically.
>>
>>57262318
So... whitespace then?
>>
>>57262634
behaves differently
>>
Well, fuck that.
Thread posts: 35
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.