Skip to content

Commit e2ec386

Browse files
committed
new readme
1 parent 27256d6 commit e2ec386

File tree

3 files changed

+80
-19
lines changed

3 files changed

+80
-19
lines changed

README.md

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
# Simple and lazy Brainf*ck interpreter
1+
```
2+
____ _ ___
3+
| __ )| | |_ _|
4+
| _ \| | | |
5+
| |_) | |___ | |
6+
|____/|_____|___|
7+
One of many brainfuck interpreters out there
8+
```
29

310

411
### Why?
@@ -8,20 +15,20 @@ Because i'm learning about compilers and interpreters
815

916
## Does it work?
1017

11-
Yes, all you need is GCC and make ( in fact you just need gcc, but typing make is faster )
18+
Yes, all you need is golang and if you need the web build, gopherjs
1219

1320
## Features
1421

1522
- Interpret Brainfuck code from either a file or standard input
1623
- Step-by-step execution with tape visualization
1724
- Debug mode for enhanced troubleshooting
18-
- Web-based interface using WebAssembly (Emscripten)
25+
- Web-based interface using WebAssembly (gopherjs)
1926

2027
## Prerequisites
2128

22-
- GCC
29+
- Golang
2330
- Make
24-
- Emscripten SDK (for WebAssembly build)
31+
- Gopherjs
2532

2633
## Installation
2734

@@ -55,24 +62,24 @@ $ echo " >++++++++[-<+++++++++>]<.>>+>-[+]++>++>+++[>[->+++<<+++>]<<]>-----.>->
5562
To interpret Brainfuck code from a file:
5663

5764
```shell
58-
$ ./bli -c your_file.bf
65+
$ ./bli -f your_file.bf
5966
```
6067

6168
For step-by-step execution:
6269

6370
```shell
64-
$ ./bli -s -c your_file.bf
71+
$ ./bli -s -f your_file.bf
6572
```
6673

6774
For debug mode:
6875

6976
```shell
70-
$ ./bli -d -c your_file.bf
77+
$ ./bli -d -f your_file.bf
7178
```
7279

7380
### Web-based
7481

75-
Open `bli.html` in your web browser. Paste your Brainfuck code into the textarea and click "Run".
82+
Open `index.html` in your web browser. Paste your Brainfuck code into the textarea and click "Run".
7683

7784
## How It Works
7885

@@ -92,3 +99,6 @@ The memory is represented by a tape, a 30,000-cell array initialized with zeros.
9299
| `>` | Increment the data pointer. |
93100
| `[` | Jump past the corresponding `]` if the byte at the data pointer is zero. |
94101
| `]` | Jump back to the corresponding `[` if the byte at the data pointer is nonzero. |
102+
103+
104+
### TODO: talk about the bytecode process

bli.go

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"log"
1010
"os"
1111

12-
//import gopherjs
1312
"github.com/gopherjs/gopherjs/js"
1413
)
1514

index.html

+61-9
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,72 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>Brainfuck Playground</title>
6+
<style>
7+
body {
8+
font-family: Arial, sans-serif;
9+
display: flex;
10+
flex-direction: column;
11+
align-items: center;
12+
margin: 0;
13+
padding: 0;
14+
}
15+
h1 {
16+
margin-top: 20px;
17+
}
18+
textarea {
19+
width: 90%;
20+
max-width: 1200px;
21+
margin: 10px 0;
22+
font-family: monospace;
23+
resize: vertical;
24+
}
25+
.options {
26+
display: flex;
27+
justify-content: center;
28+
margin-bottom: 10px;
29+
}
30+
.options label, .options input {
31+
margin: 0 10px;
32+
}
33+
button {
34+
margin-top: 10px;
35+
}
36+
pre {
37+
width: 90%;
38+
max-width: 1200px;
39+
background: #f0f0f0;
40+
padding: 10px;
41+
border: 1px solid #ccc;
42+
white-space: pre-wrap;
43+
word-wrap: break-word;
44+
}
45+
.header-art {
46+
text-align: center;
47+
font-family: monospace;
48+
margin-bottom: 20px;
49+
}
50+
</style>
651
<script src="brainfuck.js"></script>
752
</head>
853
<body>
954
<h1>Brainfuck Playground</h1>
10-
<textarea id="code" rows="10" cols="50">++++++++++[>+++++++>++++++++++>+++<<<-]>++.>+.+++++++..+++.[-]>++++++++++++.>++++++++++++.</textarea>
11-
<br>
12-
<label for="input">Input:</label>
13-
<input id="input" type="text">
14-
<br>
15-
<label for="no-interaction">No Interaction:</label>
16-
<input id="no-interaction" type="checkbox">
17-
<br>
55+
<div class="header-art">
56+
<pre> ____ _ ___
57+
| __ )| | |_ _|
58+
| _ \| | | |
59+
| |_) | |___ | |
60+
|____/|_____|___|
61+
One of many brainfuck interpreters out there</pre>
62+
</div>
63+
<div class="options">
64+
<label for="input">Command line args:</label>
65+
<input id="input" type="text">
66+
<label for="no-interaction">No Interaction:</label>
67+
<input id="no-interaction" type="checkbox">
68+
</div>
69+
<textarea id="code" rows="10"> >++++++++[-<+++++++++>]<.>>+>-[+]++>++>+++[>[->+++<<+++>]<<]>-----.>->+++..+++.>-.<<+[>[+>+]>>]<--------------.>>.+++.------.--------.>+.>+.
70+
</textarea>
1871
<button onclick="runBrainfuck()">Run</button>
19-
<br>
2072
<h2>Output:</h2>
2173
<pre id="output"></pre>
2274

0 commit comments

Comments
 (0)