chore: add readme to the repo
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -127,3 +127,4 @@ dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
1
LICENSE
1
LICENSE
@@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
44
README.md
Normal file
44
README.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# dopey - Another Brainf**k Interpreter
|
||||
|
||||
The dopey brainf\*\*k interpreter was created as a side project to become familiar with Python 3. The goal was to fully implement all the features of brainf\*\*k as defined in this [wiki page](https://en.wikipedia.org/wiki/Brainfuck#Language_design) into dopey.
|
||||
|
||||
## Demo
|
||||

|
||||
|
||||
## Implemetation Limitations
|
||||
|
||||
The dopey is limited to a memory buffer of **30,000** byte cells all initialized to zero. Any attempts to move the pointer past the bounds of the memory buffer will result in an exception being raised. Attempting to print any cell with a value outside of the defined ASCII characters may also result in an exception.
|
||||
|
||||
## Requirements
|
||||
|
||||
Make sure you've installed Python 3. You can download and install Python 3 at [python.org](https://www.python.org/downloads/).
|
||||
|
||||
Verify you have Python 3 installed by running the following:
|
||||
|
||||
```bash
|
||||
python --version
|
||||
```
|
||||
or in some systems
|
||||
```bash
|
||||
python3 --version
|
||||
```
|
||||
|
||||
## Running dopey
|
||||
|
||||
Clone the Github repository. From your terminal move to the root of the project and run the following line:
|
||||
|
||||
```bash
|
||||
python dopey.py my-bf-file.bf
|
||||
```
|
||||
|
||||
or in some systems
|
||||
|
||||
```bash
|
||||
python3 dopey.py my-bf-file.bf
|
||||
```
|
||||
|
||||
## Contributing
|
||||
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
||||
|
||||
## License
|
||||
[MIT](https://choosealicense.com/licenses/mit/)
|
||||
3
dopey.py
3
dopey.py
@@ -67,7 +67,7 @@ class Operation:
|
||||
@classmethod
|
||||
def output(cls, _) -> None:
|
||||
sys.stdout.write(chr(Memory.buffer[Memory.get_pointer()])) # TODO rollover if too big in ASCII
|
||||
sys.stdout.flush()
|
||||
sys.stdout.flush() # TODO possible performance issue
|
||||
|
||||
@classmethod
|
||||
def input(cls, _) -> None:
|
||||
@@ -127,7 +127,6 @@ def main() -> None:
|
||||
file.close()
|
||||
|
||||
switch = Operation.get_operations_in_switch()
|
||||
|
||||
while program[1] < len(program[0]):
|
||||
operation = program[0][program[1]]
|
||||
program[1] += 1
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>
|
||||
---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
|
||||
Reference in New Issue
Block a user