Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pxeger/2bcmc
esolang with a 2-bit codepage
https://github.com/pxeger/2bcmc
Last synced: 18 days ago
JSON representation
esolang with a 2-bit codepage
- Host: GitHub
- URL: https://github.com/pxeger/2bcmc
- Owner: pxeger
- License: artistic-2.0
- Created: 2021-10-18T17:34:35.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-19T07:02:26.000Z (about 3 years ago)
- Last Synced: 2024-10-12T09:35:19.612Z (about 1 month ago)
- Language: Python
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 2bcmc
2-bit "golfing" language for [Redwolf Programs' Chat Mini Challenge](https://chat.stackexchange.com/transcript/message/59389303#59389303):> CMC: Make a somewhat golf-oriented language with a two bit code page.
> Brownie points if it's TC## Documentation
2bcmc is a stack-based language, and its commands operate on a stack of integers.If a command pops from an empty stack, an integer is instead read from STDIN.
After the program finishes, the stack is printed, separated by newlines.
There are four three commands:
- `=`: load integer literal
- `*`: repeat + eval
- `-`: subtract
- (there will be a fourth command, but there isn't yet)Line feeds and spaces are ignored. All other characters are invalid.
### Load Integer Literal
This keeps reading commands until it finds another `=`, decodes those commands as a base-3 integer, and pushes the
result to the stack.### Repeat + Eval
- pop a value from the stack, call it `p`
- decode `p` in bijective base 4, to an array of commands forming a `2bcmc` program
- pop another value from the stack (underneath `p`), call it `n`
- `n` times: execute that decoded programIf `n` is negative, the program is executed exactly once. If it is zero, the program is not executed.
### Subtract
This pops two values from the stack, subtracts them, and pushes the result.Note the operation's order: if the top of the stack is `a` and the value underneath is `b`, then the result is **`a - b`**.