-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
532861a
commit d521904
Showing
146 changed files
with
46,720 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Git ignore file | ||
# See: https://git-scm.com/docs/gitignore | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# IDE | ||
.idea | ||
.vscode | ||
|
||
# Composer | ||
vendor |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,11 @@ | ||
# Brainfuck-Interpreter-PHP | ||
A Brainfuck Interpreter written in PHP. | ||
Look into the main.php file for help. | ||
# brainfuck-php | ||
A brainfuck interpreter written in PHP. | ||
|
||
## Requirements | ||
- PHP >= 7.0 | ||
- PHP >= 7.4 | ||
|
||
## Example usage | ||
```php | ||
<?php | ||
include("path/to/main.php"); | ||
|
||
$file = "path/to/HelloWorldExample.bf"; | ||
$config = [ | ||
"cellsize" => 8/* bit */, | ||
"infinitememory" => false, | ||
"memorysize" => 30000, | ||
"memoverflow" => 2, // 1 = nothing, 2 = wrap, 3 = abort | ||
"inputmode" => "string" // "string" or "char" | ||
]; | ||
|
||
$bfi = new BFI($config); | ||
$bfi->readFile($file); | ||
$bfi->run(); | ||
?> | ||
## Usage | ||
```bash | ||
$ ./bin/bfi.php ./examples/hello.bf | ||
Hello World! | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env php | ||
<?php declare(strict_types=1); | ||
|
||
if (!ini_get('date.timezone')) { | ||
ini_set('date.timezone', 'UTC'); | ||
} | ||
|
||
if (isset($GLOBALS['_composer_autoload_path'])) { | ||
define('COMPOSER_AUTOLOAD_PATH', $GLOBALS['_composer_autoload_path']); | ||
|
||
unset($GLOBALS['_composer_autoload_path']); | ||
} else { | ||
foreach ( | ||
[ | ||
__DIR__ . '/../../autoload.php', | ||
__DIR__ . '/../vendor/autoload.php', | ||
__DIR__ . '/vendor/autoload.php', | ||
] as $file | ||
) { | ||
if (file_exists($file)) { | ||
define('COMPOSER_AUTOLOAD_PATH', $file); | ||
|
||
break; | ||
} | ||
} | ||
|
||
unset($file); | ||
} | ||
|
||
if (!defined('COMPOSER_AUTOLOAD_PATH')) { | ||
fwrite( | ||
STDERR, | ||
'You need to set up the project dependencies using Composer:' | ||
. PHP_EOL | ||
. PHP_EOL | ||
. ' composer install' | ||
. PHP_EOL | ||
. PHP_EOL | ||
. 'You can learn all about Composer on https://getcomposer.org/.' | ||
. PHP_EOL, | ||
); | ||
|
||
die(1); | ||
} | ||
|
||
require COMPOSER_AUTOLOAD_PATH; | ||
|
||
$fp = fopen($argv[1], 'r'); | ||
\Brainfuck\BrainfuckInterpreter::interpret($fp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "jonasgeiler/brainfuck", | ||
"description": "A brainfuck interpreter written in PHP", | ||
"type": "project", | ||
"homepage": "https://github.com/skayo/brainfuck-php#readme", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Jonas Geiler", | ||
"email": "composer@jonasgeiler.com", | ||
"homepage": "https://skayo.dev" | ||
} | ||
], | ||
"support": { | ||
"issues": "https://github.com/skayo/brainfuck-php/issues" | ||
}, | ||
"require": { | ||
"php": ">=7.4" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.6" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Brainfuck\\": "src/" | ||
}, | ||
"files": [ | ||
"src/constants.php" | ||
] | ||
}, | ||
"bin": [ | ||
"bin/bfi.php" | ||
], | ||
"prefer-stable": true, | ||
"keywords": [ | ||
"experiment", | ||
"brainfuck", | ||
"interpreter", | ||
"brainfuck-interpreter" | ||
] | ||
} |
Oops, something went wrong.