befunge's Introduction
Befunge Interpreter. by Matthew Bender Last updated 6/25/2014 - Done full compliance with Befunge-93. Report any bugs to [email protected] This interpreter is intended to be compliant with Befunge-93 (with possibility to extend to Befunge-98 later). To use: Download all the .c and .h files here, as well as the Makefile. Then just run 'make' and the executable bfg is created. bfg takes 1 argument, the name of the Befunge file to interpret. You can also run the befunge interpeter manually in C by using bfg_run(). Make sure to initialize the struct befunge_program properly first and cleanup afterwards (see main.c for how to do this). Information on how to code in Befunge can be found at en.wikipedia.org/wiki/Befunge Some notes on liberties I have taken: -In the Befunge file, code outside of the playfield is ignored. -Popping and peeking from an empty stack returns 0. -The stack consists of signed integers. -Using the 'g' command outside the bounds of the playfield will push 0 onto the stack -Using the 'p' command outside the bounds of the playfield will do nothing -Printing does not print a space as well, like some interpreters I've found -The random number generator is seeded only once, at the start of execution. This is not a problem if you are just using the executable bfg. However, if you want to run the befunge interpreter through the provided methods, you will have to seed the RNG yourself. -To run the same Befunge program 2x, call bfg_init() and bfg_load_code() the first time, then run, but the second time, only call bfg_init(), or fseek() to the beginning of the file before passing the file pointer to bfg_load_code() -Memory allocated will be automatically freed once the Befunge program is done executing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.