Omnimaga

General Discussion => Other Discussions => Miscellaneous => Topic started by: Scipi on October 07, 2011, 08:05:25 am

Title: Enhanced BF
Post by: Scipi on October 07, 2011, 08:05:25 am
Hello all,

After making a Brainf*ck interpreter located here (http://ourl.ca/13264), I thought it would be interesting if I improved the language and made it on par with most other languages.

So I ask you all, what do you want to see added to the language? So far my ideas are a second array of 30000 bytes that can be accessed for things like memory addresses, conditions, etc.

Here are some symbols I might add

{//For
}//EndFor
://If
;//EndIf
|//Goto
'//Write value
=//Copy Value address

I might call this new language, Mindf*ck! :P
Title: Re: Enhanced BF
Post by: turiqwalrus on October 07, 2011, 08:45:41 am
but isn't brainf*ck supposed to be bare-bones and really hard to use?
IMO, adding that stuff would kinda ruin the point :P
Title: Re: Enhanced BF
Post by: JustCause on October 07, 2011, 09:03:03 am
but isn't brainf*ck supposed to be bare-bones and really hard to use?
IMO, adding that stuff would kinda ruin the point :P
It'd still be ridiculously hard to use. The difference would be that you could actually make stuff with it. :D I support this.
Title: Re: Enhanced BF
Post by: turiqwalrus on October 07, 2011, 09:24:17 am
but isn't brainf*ck supposed to be bare-bones and really hard to use?
IMO, adding that stuff would kinda ruin the point :P
It'd still be ridiculously hard to use. The difference would be that you could actually make stuff with it. :D I support this.
true...
a lack of for loops limits it ALOT...
Title: Re: Enhanced BF
Post by: Scipi on October 07, 2011, 01:27:12 pm
lol I plan on having a small interpreter. (loops and such are EASY to emulate) And it will still be semi difficult (BF actually isn't all that hard imo)

I just want to actually be able to DO what you want it to do. :)

I just need ideas to implement. :D
Title: Re: Enhanced BF
Post by: AngelFish on October 07, 2011, 03:23:27 pm

true...
a lack of for loops limits it ALOT...

What? Regular brainf*ck has For loops...

Code: [Select]
++++[>+<-] is equivalent to For(4){+}

Also, using goto makes conforming to the original BF spec very difficult because it's difficult to confirm that each open bracket has a closing bracket.

PS: What do = and ' do? If = copies the value at the byte pointed to by the current memory cell into the current memory cell, then I think it's an excellent addition to the language.
Title: Re: Enhanced BF
Post by: thepenguin77 on October 07, 2011, 03:31:16 pm
It'd still be ridiculously hard to use. The difference would be that you could actually make stuff with it. :D I support this.

I'd like to point out that BrainF*ck is turing-complete. What this means is that anything that can be done on any modern computer, can be done in BrainF*ck.

If you had a lot of time to spare, it is, by definition, possible to factor the Nspire OS key using only BrainF*ck.
Title: Re: Enhanced BF
Post by: NecroBumpist on October 07, 2011, 03:37:04 pm
The only things brainf*ck requires (do we actually need to censor this here at Omnimaga?) is subroutines.

I have no idea how to implement.
Title: Re: Enhanced BF
Post by: Scipi on October 07, 2011, 04:37:12 pm
Quote
Also, using goto makes conforming to the original BF spec very difficult because it's difficult to confirm that each open bracket has a closing bracket.

I'm thinking that when it checks it will skip goto statements for it.

Quote
The only things brainf*ck requires (do we actually need to censor this here at Omnimaga?) is subroutines.

Using goto will effectively allow for subroutines to be written. I'll just have to have a return command.

Quote
What do = and ' do? If = copies the value at the byte pointed to by the current memory cell into the current memory cell, then I think it's an excellent addition to the language

It will copy the value at the current cell to the cell pointed to by the corresponding cell in the other array. (MF will have two corresponding arrays for this kind of purpose) :D

' will just read the value in the current cell without the conversion to ASCII. So a 4D in the cell will print 4D or it's decimal counterpart.
Title: Re: Enhanced BF
Post by: JustCause on October 07, 2011, 06:31:01 pm
It'd still be ridiculously hard to use. The difference would be that you could actually make stuff with it. :D I support this.

I'd like to point out that BrainF*ck is turing-complete. What this means is that anything that can be done on any modern computer, can be done in BrainF*ck.

If you had a lot of time to spare, it is, by definition, possible to factor the Nspire OS key using only BrainF*ck.
Okay, I'll modify my definition of "you" to exclude those gifted with extraordinary patience, extraordinary intelligence, and ESP. XD
Title: Re: Enhanced BF
Post by: Scipi on October 08, 2011, 07:30:29 pm
Interesting site I found listing different derivatives of BF. I might get some rather nice ideas off these! :D
http://esoteric.voxelperfect.net/wiki/Category:Brainfuck_derivatives (http://esoteric.voxelperfect.net/wiki/Category:Brainfuck_derivatives)
Title: Re: Enhanced BF
Post by: DJ Omnimaga on October 08, 2011, 11:36:27 pm
@topic title: Enhanced Boyfriend? ???

J/k I think brainfuck was definitively made purposely hard to use, so if it was enhanced to be easier, it would kinda defeat its point, as pointed above :P
Title: Re: Enhanced BF
Post by: AngelFish on October 08, 2011, 11:58:13 pm
Brainf*ck was actually designed to have the smallest compiler possible for a Turing complete language.
Title: Re: Enhanced BF
Post by: NecroBumpist on October 09, 2011, 12:01:05 am
Quote
The only things brainf*ck requires (do we actually need to censor this here at Omnimaga?) is subroutines.

Using goto will effectively allow for subroutines to be written. I'll just have to have a return command.

Meh, I would forego a return command in favor of having control over the PC (slightly more esoteric than simple call and return instructions).
# to load the PC into the current cell
@ to load the current cell into the PC

But then, whilst trying to make a shitty example, I realized this would make maintaining brainfuck code even more difficult without some form of labels.
Title: Re: Enhanced BF
Post by: Scipi on October 09, 2011, 12:44:23 pm
I actually have no intent on following the original principles of BF. (If you want a hard language to use, just use original BF) :D

I just want to increase it's functionality in order to make it do cooler things without extreme patience. :P
Title: Re: Enhanced BF
Post by: Scipi on September 19, 2012, 11:25:48 pm
Ok, so after nearly a year, I actually have something to show for this (Holy crap!)

Introducing Mindf*ck:

A dialect of BF that on top of the original BF command set and principles, adds functionality for using addresses, splitting threads, moving throughout the code (read: subroutines), and the ability to insert values in the code itself easier.

The command list is as follows:
//////////////////////
//BrainF*ck Commands
//////////////////////
>   Shift right
<   Shift left
+   Inc
-   Dec
[   Start while if nonzero
]   End while - break if zero (Jump to address if nonzero)
.   Get char
,   read char
/////////////////////
//MindF*ck Commands
/////////////////////
#   Get Int
$   Read Int
(   Store address
)   Pop address
{   Copy value to address
}   Retrieve value at address
""   Insert string - overwrites its length
::   Insert binary num   
^   Jump to address
|   Split thread at code address
!   Ends process

The main difference is the addition of a stack used for addresses as well as storing values. Think like what Z80 has. You are also able to move around the code itself to execute sections of code.

"<string>" allows for strings of chars to be inserted into the value array, it will overwrite its length in chars.
:<Number>: this will insert an int expressed in binary at this point in the value array

Another difference is that instead of chars, the array is composed of ints. I did this in order to support jumps using values in the value array.

Things to do:

Fix the split thread command. Weird stuff is happening and I'm not sure why.

More bug testing

Source:

https://sourceforge.net/projects/mindfck/ (https://sourceforge.net/projects/mindfck/)

Edit: I forgot to mention, I still need to write up the full documentation for how each command works and what exactly they read from/effect. Some of the address commands either affect the value array iterator or code iterator, for instance.