Skip to main content

Brainfuck Programming language


Brainfuck is an esoteric programming language. Its notation is extremely minimalism. This language use only eight single character as command and a instruction pointer.

Why was this language created?
In 1993, young computer programmer named “Urban Müller” set out to make the smallest possible compiler, because smaller the compiler  lesser time and energy it takes for the machine to respond.
In the end, he came up with “Brainfuck” a new programming language whose compiler uses only 240 bytes of memory making it around 11,000 time smaller than C++ compiler.
However, making such a smaller compiler, Muller has sacrificed practically.  

In Brainfuck, you can only use eight command have single character:



Character

Meaning

>

increment the data pointer (to
point to the next cell to the right).

<

decrement the data pointer (to
point to the next cell to the left).

+

increment (increase by one) the
byte at the data pointer.

-

decrement (decrease by one) the
byte at the data pointer.

.

output the byte at the data
pointer.

,

accept one byte of input,
storing its value in the byte at the data pointer.

[

if the byte at the data pointer
is zero, then instead of moving the instruction pointer forward to
the next command, jump it forward to the command
after the matching 
] command.

]

if the byte at the data pointer
is nonzero, then instead of moving the instruction pointer forward to the
next command, jump it back to the command after the matching 
[ command.



That it.
Can you imagine yourself writing codes with this language? Now you can relate why the name of this language is brainfuck. The language stick to its name. We should give credit to the founder giving this incredible name.
So, basically how it works?
This language work on ASCII code. You have to code in such a way the you get the ASCII value of the character you want to print.
Example: You want to print “A”
1.      ++++++++++++…. +++                [65 time (each “+” add a [0]=i++]
2.      .                                                     (“.” to print the “A”)
Its works on shifting operation it has an array who’s default value is “zero”.
So here what happens is when the array get the value 65 and print command is executed then the compiler will look for who’s ASCII value is 65 and show the output when it get it.
>: move to next array index in right


Now, let to do a program which all programmer do when they starting learning  a new language print “Hello world!”

The code for the program is:

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

To better understand the step, click on this LINK.

For more understanding the concept.

Related link: Stack-overflow


Comments

Popular posts from this blog

Secure Network(Week 4)

Network hardening is the process of securing a network by reducing its potential vulnerabilities through configuration changes and taking specific steps.   Implicit deny is a network security concept where anything not explicitly permitted or allowed should be denied. Analyzing logs is the practice of collecting logs from different networks and sometimes client devices on your network, then performing an automated analysis on them. Correlation analysis is the process of taking log data from different systems and matching events across the systems. Flood guards provide protection against Dos or denial of service attacks. EAP-TLS is an authentication type supported by EAP that uses TLS to provide mutual authentication of both the client and the authenticating server.   if you really want to lock down your network, you can implement 802.1x . DHCP Snooping Attack Why WEP Encryption fall apart? A general concept in security and encryption is to never send the plain ...

Troubleshooting and debugging

Troubleshooting is the process of identifying, analyzing, and solving problems.  Debugging is the process of identifying, analyzing, and removing bugs in a system. We sometimes use troubleshooting and debugging interchangeably.  But generally, we say troubleshooting when we're fixing problems in the system running the application, and debugging when we're fixing the bugs in the actual code of the application. Debuggers let us follow the code line by line, inspect changes in variable assignments, interrupt the program when a specific condition is met, and more. System calls are the calls that the programs running on our computer make to the running kernel.   A reproduction case is a way to verify if the problem is present or not. Where to check for log file in OS? On Linux , you'd read system logs like /var/log/syslog and user-specific logs like the .xsession-errors file located in the user's home directory. On MacOs , on top of the system logs, you'd go through...

Authentication Authorization Accounting(week 3)

Identification is the idea of describing an entity uniquely. Biometric authentication is the process of using unique physiological characteristics of an individual to identify them. C.R.L(Certificate revocation list) :This is a signed list published by the CA which defines certificates that have been explicitly revoked. Lightweight Directory Access Protocol(LDAP): LDAP is an open industry-standard protocol for accessing and maintaining directory services. Authentication is related to verifying the identity a user, authorization pertains to describing what the user account has access to or doesn't have access to. An access control list or ACL , is a way of defining permissions or authorizations for objects.  RADIUS or Remote Authentication Dial-In User Service , is a protocol that provides AAA services for users on a network.It's a very common protocol used to manage access to internal networks, WiFi networks, email services and VPN services. when a client wants to access a r...