https://github.com/aaronjanse/interlocking-braces
The esolang where code like {(}) is the norm
https://github.com/aaronjanse/interlocking-braces
esolang
Last synced: 4 months 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-09T07:28:27.000Z (almost 8 years ago)
- Last Synced: 2025-05-18T08:36:10.504Z (6 months ago)
- Topics: esolang
- Language: Python
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 2
- 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.

## 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 user
I/O:
`.` pop the top of the stack and print as integer
`,` pop the top of the stack and print as ASCII character
Literals:
`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 ms
Examples:
```
(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)
```