PHP Classes

Brainf_uck Interpreter Class: Interpret and execute Brainf_uck language code

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 20 All time: 11,292 This week: 57Up
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: 2025
Week rank: 206 Up

Example

<?php

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

require "bf.class.php";

//Hello world!

new Brainfuck("

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

"
);

?>


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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:20
This week:0
All time:11,292
This week:57Up