OokBF Interpreter and Debugger

Run Your Favorite Applications Online

OokBF / Tutorial / Page 1

Learn Programming in 30 minutes, Here and Now
Page 1 of 3

Published 2024/04/29

Hello and welcome to this computer programming tutorial.

This tutorial is an introduction to computer programming for complete beginners. The tutorial explains the most essential computer programming concepts by using the programming language BF.

The language BF is an excellent first programming language to learn, due to its overwhelming simplicity. The language consists of only eight commands, while other computer languages usually require learning hundreds of commands. Learning just eight simple commands should be fast and easy. In less than 30 minutes, you will learn the entire programming language BF.

The Interpreter's Interface

Before you start writing programs in the language BF, you first need to familiarize yourself with the BF interpreter's interface. The OokBF interpreter is available here (or you can just click on the title of this page). You should run the example programs provided with the interpreter. Use the “Run” button on the OokBF interpreter's page to run each example program.

You will notice that some example programs end immediately, while others take a very long time to end, or they do not end at all. Any program can be immediately terminated by using the interpreter's “Terminate” button.

The Eight Commands of the Language BF

The language BF consists of only eight simple commands. It is a good idea to have a quick glance at all of them. For an overview, we list all eight commands in the following table:

Name Symbol Description
increment + increase the value by one
decrement - decrease the value by one
output . output one byte
input , input one byte
move left < move one cell to the left
move right > move one cell to the right
skip [ if the cell value is zero, then skip all commands before the matching bracket
repeat ] if the cell value is nonzero, then go back to the first command after the matching bracket

In the table, each command has a name and a symbol. Symbol for each command is just one character.

The Debugger's Interface

Now you need to familiarize yourself with the debugger's interface.

Select the first and the simplest example program, the “Hello World!”. Then, click on the “Enable Debugger” button.

The debugger's interface will then be displayed. You should also open the “Memory watch” interface at the bottom of the debugger's interface. The memory watch displays contents of the memory cells, from the cell numbered 0 to cell 39.

Click on the “Debug Start” button to start the “Hello World!” program. The program won't execute any commands yet. All the memory cells will be reset to value zero, and the first cell, numbered “0” will be highlighted in green color.

Now, click on the “Step by 1 instruction” button. Click on it many times. The values of the memory cells will be increasing. The debugger will execute one command every time you click the “Step by 1 instruction” button. You can observe the execution of commands in the instruction stream above the “Step” buttons. An “instruction” is just another name for a “command”.

Click the “Step by 1 instruction” button at least 40 times, and observe the changes.

The program will output the text “Hello World!” near the end of the execution. The entire execution is 390 instructions long, so you would need a lot of clicking to get to the end of the program. If you like, you can try out the other “Step”” buttons to step faster through the “Hello World!” program. You can also use other buttons to restart or terminate the program.

What do the Commands do?

If you click on the “Step by 1 instruction” button slowly, you will be able to observe that most instructions do exactly what the table of commands says, as described earlier in this article.

The instruction + increases a memory cell by one; the instruction > moves one cell to the right, etc.

In the next chapter, you will learn how to write your own programs by using the eight commands of the programming language BF.