cboin / brainfuck-interpreter Goto Github PK
View Code? Open in Web Editor NEWA simple brainfuck interpreter
A simple brainfuck interpreter
This should print "Hello World!" and a newline.
+[>[<->+[>+++>[+++++++++++>][]-[<]>
-]]++++++++++<]>>>>>>----.<<+++.<-.
.+++.<-.>>>.<<.+++.------.>-.<<+.<.
brainfuck-interpreter/brainfuck-interpreter.c
Lines 104 to 113 in dab492f
Theses two instructions should jump to the matching brackets, not just to the closest brackets.
On esolangs you can read this about theses two instructions:
Command | Description |
---|---|
[ |
Jump past the matching ] if the cell under the pointer is 0 |
] |
Jump back to the matching [ if the cell under the pointer is nonzero |
If you want to be able to run program like that:
>++++++++[-<+++++++++>]<.>>+>-[+]++>++>+++[>[->+++<<+++>]<<]>-----.>->
+++..+++.>-.<<+[>[+>+]>>]<--------------.>>.+++.------.--------.>+.>+.
You need to handle negative cells which you don’t currently:
brainfuck-interpreter/brainfuck-interpreter.c
Lines 76 to 82 in dab492f
// ptr = t;
ptr = t + (buflen / 2);
Also the fascist appellation for this kind of interpreter come from here: http://www.hevanet.com/cristofd/brainfuck/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.