All Projects → adam-mcdaniel → smpl

adam-mcdaniel / smpl

Licence: other
A superset of brainfuck with dynamic memory management.

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to smpl

Brainfuck
A flexible Brainfuck / Brainloller / Braincopter interpreter in Swift 3.1.
Stars: ✭ 13 (-40.91%)
Mutual labels:  brainfuck
vbf
A brainfuck interpreter/compiler written in V.
Stars: ✭ 17 (-22.73%)
Mutual labels:  brainfuck
FasterBrainfuckProgramming
This project is to make brainfuck language programming easier, faster and more powerful .. everything is made out of functions making it very easy to port to other languages
Stars: ✭ 19 (-13.64%)
Mutual labels:  brainfuck
esoo
Like the Programming Languages Zoo but with esoteric languages.
Stars: ✭ 18 (-18.18%)
Mutual labels:  brainfuck
llvm-brainfuck
Brainfuck compiler based on LLVM API
Stars: ✭ 27 (+22.73%)
Mutual labels:  brainfuck
Klipse
Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.
Stars: ✭ 2,841 (+12813.64%)
Mutual labels:  brainfuck
BrainfuckIDE
A Brainfuck IDE/debugger designed to be intuitive, featureful and visually appealing
Stars: ✭ 77 (+250%)
Mutual labels:  brainfuck
brainsuck
A simple optimizing Brainfuck compiler (used as the demo for my QCon Beijing 2015 talk)
Stars: ✭ 55 (+150%)
Mutual labels:  brainfuck
BfBf
A Brainfuck interpreter written by Brainfuck.
Stars: ✭ 37 (+68.18%)
Mutual labels:  brainfuck
AshBF
Over-engineered Brainfuck optimizing compiler and interpreter
Stars: ✭ 14 (-36.36%)
Mutual labels:  brainfuck
brainfuck2wasm
A brainfuck-to-WebAssembly compiler
Stars: ✭ 36 (+63.64%)
Mutual labels:  brainfuck
rot13
This is a collection of ROT13 encoding programms written in different languages. Just for fun.
Stars: ✭ 24 (+9.09%)
Mutual labels:  brainfuck
BrainF.Net
A .NET brainfuck code parsing and execution library
Stars: ✭ 23 (+4.55%)
Mutual labels:  brainfuck
brainhug
A simple brainfuck translator crate in Rust
Stars: ✭ 14 (-36.36%)
Mutual labels:  brainfuck
bfboot
A full brainfuck to bootable OS image compiler.
Stars: ✭ 35 (+59.09%)
Mutual labels:  brainfuck
Headache
Programming Language that compiles to 8 Bit Brainfuck
Stars: ✭ 59 (+168.18%)
Mutual labels:  brainfuck
ojisan f-ck
おじさん風文章を解釈して動く Brainfuck interpreter
Stars: ✭ 20 (-9.09%)
Mutual labels:  brainfuck
bfpile
Optimizing Brainfuck compiler, transpiler and interpreter
Stars: ✭ 19 (-13.64%)
Mutual labels:  brainfuck
harbor
A language that ports⚓: examining the limits of compilation⚙️.
Stars: ✭ 81 (+268.18%)
Mutual labels:  brainfuck
bf256
Brainfuck compiler under 256 bytes in size.
Stars: ✭ 21 (-4.55%)
Mutual labels:  brainfuck

smpl

smpl is a superset of brainfuck with 3 additional operators for dynamic memory allocation and management. This allows smpl to compilation from much higher level languages, as implementations for patterns like vector and string are possible.

Operators

Command Description
> Move the pointer to the right
< Move the pointer to the left
+ Increment the memory cell under the pointer
- Decrement the memory cell under the pointer
. Output the character stored at the cell under the pointer
, Input a character and store it in the cell under the pointer
[ Jump past the matching ] if the cell under the pointer is zero
] Jump back to the matching [ if the cell under the pointer is not zero
* Set the pointer equal to the value of the current cell
& Set the pointer back to the value it was before the last *
? With the value of the cell under the pointer, store the address of the first instance of that many consecutive zeros from the left of the tape at the current cell

Tape Attributes

The user should ALWAYS be able to set tape length for each implementation of smpl. A default value for the tape length may be used, but DO NOT bar the user from setting it.

Cells must be unsigned 32 bit integers, and the pointer is an unsigned 32 bit integer as well.

Extreme Behavior

Extreme behavior describes behavior that is very important to keep note of while implementing smpl. If the implementation does not implement extreme behavior properly, then it is not a valid implmentation of smpl. The goal of documenting extreme behavior is to help guarantee that all implementations of smpl are compatible. Keeping note of the very specific behaviors of smpl helps ensure this.

  • When the & operator is called before the * operator has been called, the pointer jumps to cell 0
  • When a cell's value is 0 and the - operator is called, the cell overflows to the maximum value a 32 bit integer can store.
  • After the , operator first returns EOF, it will continue to return EOF every time it is called until the program ends. EOF is zero.
  • ? will replace the size parameter of the current cell with the address of free memory with that size. The address stored in the current cell will point to the leftmost cell in that block of memory.
  • The . operator will convert the value in the cell to a character and print the character. If the number is greater than 255, the . operator will divide by 256 and print the remainder as a character.
  • The & operator will only record the previous 256 * calls.

Undefined Behavior / Errors

Undefined behavior is EXTREMELY frowned upon. If possible, make undefined behavior throw errors in your implementation.

Undefined behavior includes

  • Overflowing the pointer
  • Setting / Incrementing the pointer past the length of the tape
  • Attempting to allocate an unavailable amount of memory with the ? operator
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].