Programming Help by Programmer's hub

Befunge Programming language

Befunge is a 2-dimentional stack based, reflective, esoteric programming language. The meaning of the 2-Dimentional programming language is it's data all in a line and con only be accessed one at a time. The 2-D language is difficult to read as a program. In simple programming language its easy to read and understand the code but in 2-D programing the code is like map and scattered in four dimentions. In the Befunge programming language you can get data: from the stack, from the user, from the code itself. Befunge programming language have two modes of execution of program :

  • Normal mode execution
  • String mode

There are two commands you have to be aware of whenever you use a stack and they are "push" and "pop". Push places an element on top of the stack and Pop on the other hand removes the newest element from the stack to use in normal execution of the program.

Befunge Programming code example

vv  <      <                                                                   
    2                                                                          
    ^  v<                                                                      
 v1<?>3v4                                                                      
    ^   ^                                                                      
>  >?>  ?>5^                                                                   
    v   v                                                                      
 v9<?>7v6                                                                      
    v  v<                                                                      
    8                                                                          
    >  >   ^                                                                   
 vv  <      <                                                                  
     2                                                                         
     ^  v<                                                                     
  v1<?>3v4                                                                     
     ^   ^                                                                     
 >  >?>  ?>5^                                                                  
     v   v      v          ,*25         <<                                     
  v9<?>7v6                              ,,                                     
     v  v<                              ""                                     
     8                                  ><                                     
     >  >   ^                           ""v                                    
  >*:.>0"!rebmun tupnI">:#,_$25*,:&:99p`|^<       _0"!niw uoY">:#,_$25*,@      
      ^         <                       >:99g01-*+^
 

Befunge instructions

Command Instruction
+ Add two top stack values
- Subtract two top stack values
* Multiply two top stack values
/ Division
% Modulo division
! Logical NOT