https://github.com/kvbc/char
Single character esoteric programming language
https://github.com/kvbc/char
esoteric-programming-language interpreter
Last synced: 26 days ago
JSON representation
Single character esoteric programming language
- Host: GitHub
- URL: https://github.com/kvbc/char
- Owner: kvbc
- License: apache-2.0
- Created: 2020-10-22T20:04:13.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2020-11-16T14:48:43.000Z (over 5 years ago)
- Last Synced: 2025-08-28T14:46:26.799Z (11 months ago)
- Topics: esoteric-programming-language, interpreter
- Language: C
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

Char is an esoteric stack based programming language, which commands are single characters. The language was designed to be simple.
___
# Syntax
Char's syntax can be represented as a table of commands:
| Command | Parameter | Meaning |
| :-------: | :-------: | :-------------------------------------------------------------- |
| `>` | Number | Push a number onto the stack |
| `<` | - | Discard the top item on the stack |
| `+` | - | Pop `a` and `b`. Push `a + b` |
| `-` | - | Pop `a` and `b`. Push `b - a` |
| `*` | - | Pop `a` and `b`. Push `b * a` |
| `/` | - | Pop `a` and `b`. Push `b / a` |
| `%` | - | Pop `a` and `b`. Push `b % a` |
| `.` | - | Pop `a` and print it as a character |
| `,` | - | Read `a` and push it's ASCII value onto the stack |
| `"` | - | Duplicate the top item on the stack |
| `&` | - | Swap the top two items on the stack |
| `#` | - | Ignore the next characters to the end of the line
| `~` | - | Run the next statement if top of the stack is lower than 0 |
| `?` | - | Run the next statement if top of the stack is not 0 |
| `^` | Label | Mark a location in the program |
| `:` | Label | Jump to a label |
| `;` | Label | Call a subroutine |
| `!` | - | End a subroutine and transfer control back to the caller |
| `@` | - | End the program |
___
# Timeline
- [x] `v1` - The first version of Char
- [x] `v1.0` - the base release
- [x] `v1.0.1` - syntactic sugar
- [x] `v2` - The last version of Char
- [x] `v2.0` - the base release
___
# Example
A program that prints its input:
```
# out.char
^read
,
? :print
@
^print
.
:read
```
More examples can be found in the `examples` directory
___
# Usage
After you've built an executable you can run it according to this usage:
` `
- `` - path to your executable
- `` - path to your source file
- `` - input of the program `(optional)`
___
###### This README and many other things were inspired by the repository of the [Night](https://github.com/DynamicSquid/night) programming language