PHP Classes

Brainf_uck Interpreter Class: Interpret and execute Brainf_uck language code

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 19 This week: 1All time: 11,196 This week: 560Up
Version License PHP version Categories
bf_interpreter 1.0.1BSD License5PHP 5, Emulators, Parsers
Description 

Author

This class interprets and executes Brainf_uck language code.

It takes a string with the language source code and parses it to execute each character, reading data from the script input.

Currently it supports 8 commands and processes an array of character cells of up to 30000 positions.

- Get input value
- Output a value
- Increments the cell value
- Decrements the cell value
- Increments the cell pointer
- Decrements the cell pointer
- Start and end executing a block
- Supports nested loops

Picture of Name Removed
  Performance   Level  
Name: Name Removed <contact>
Classes: 4 packages by
Country: ???
Age: ???
All time rank: 2029
Week rank: 109 Up

Example

<?php

/****
****
*** @ Brainf_ck interpreter class
*** @ Developed by Takis Maletsas
****
****/

require "bf.class.php";

//Hello world!

new Brainfuck("

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

"
);

?>


  Files folder image Files  
File Role Description
Plain text file bf.class.php Class Class Source
Accessible without login Plain text file example.php Example Example

 Version Control Unique User Downloads Download Rankings  
 0%
Total:19
This week:1
All time:11,196
This week:560Up