Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aaronjanse/interlocking-braces
The esolang where code like {(}) is the norm
https://github.com/aaronjanse/interlocking-braces
esolang
Last synced: 9 days ago
JSON representation
The esolang where code like {(}) is the norm
- Host: GitHub
- URL: https://github.com/aaronjanse/interlocking-braces
- Owner: aaronjanse
- Created: 2017-09-11T23:16:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-09T07:28:27.000Z (about 7 years ago)
- Last Synced: 2024-11-07T08:50:11.752Z (about 2 months ago)
- Topics: esolang
- Language: Python
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Demo of program flow. The numbers and underscores are for visual effect, and the braces are what make the instruction pointer jump around.
![Demo of program flow](https://raw.githubusercontent.com/aaronduino/interlocking-braces/master/demo.gif?raw=True)
## How to run the interpreter
The only argument is the file that you want to run.For example, this is how you would run the file `bounce.ib`:
```
python3 __main__.py bounce.ib
```## Language Specs
Control Flow:
`(` `)` `[` `]` `{` `}` jump to matching brace`?` pop top of stack; skip next char if >0
`;` skip next char (unconditionally)`&` terminate the program
Stack Operations:
_Note: Trying to get the top element from an empty stack returns 0_`~ ` switch active stack
`^` push from register
`v` pop to register (but don't change the register)`\` swap top two elements
`:` duplicate top element`$` pop the top of the stack and discard
`#` get integer from user
`@` get character from userI/O:
`.` pop the top of the stack and print as integer
`,` pop the top of the stack and print as ASCII characterLiterals:
`123` specify numbers like normal
`_` delimit numbers (if needed)
`"abc"` string literal
`i"abc"` string literal put in stack in reverse (so that it will be popped in order)Arithmetic:
`+`
`-`
`*`
`/`
`%`
`=`
`>`
`<`
`!`
`|`Misc:
`w` wait for 1 msExamples:
```
(hello world)
i"Hello, world!";(,:?)
``````
(counter)
;(1+:.)
``````
(fibonacci)
0v;(^1+:v+:.)
``````
(factorial)
1~#v;[1+:^\v~^*~v:^=?]~.
``````
(factorial -- explained)
1~ (add 1 to left stack)
#v (store input in register)
;[ (enter loop)
1+ (add 1 to counter)
: (make a copy)
^\v (swap inputted value with counter)
~ (move to left stack)
^ (push the counter (on the register) onto the stack)
* (multiply)
~ (move back to right stack)
v (put inputted value back in register)
:^=?] (if counter > inputted value, exit)
~. (print value on left stack)
```