https://github.com/mayugestudio/piled
Stack-Based Programming language
https://github.com/mayugestudio/piled
programming-language stack-based
Last synced: 14 days ago
JSON representation
Stack-Based Programming language
- Host: GitHub
- URL: https://github.com/mayugestudio/piled
- Owner: MayugeStudio
- License: mit
- Created: 2024-08-16T00:21:44.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-03-10T10:41:55.000Z (3 months ago)
- Last Synced: 2026-03-10T16:57:19.978Z (3 months ago)
- Topics: programming-language, stack-based
- Language: Go
- Homepage:
- Size: 212 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Piled
A simple stack based programming language implemented in Golang.
There is no memory concept in piled but only stack.
> [!WARNING]
> This is not serious project. Just a recreational one.
## Example
### Arithmetic Operators
```
4 2 + print
4 2 - print
4 2 * print
4 2 / print
```
Piled supports basic arithmetic operators such as +, -, *, /.
The output of the above program should be
```
6
2
8
2
```
### Conditional expressions
Piled supports conditionals.
```
100 0 > if {
255 print
} else {
0 print
}
```
Since 100 is greater than 0, the above Piled program should output 255.
### Loop
Piled supports loops.
```
10 while dup 0 > {
dup print
1 -
}
```
The above program should output
```
10
9
8
7
..
1
```
The sequence of words between `while` and `{` are considered the condition and
they are executed at each step of loop.
## Usage
#### Run a program from a file
```console
./piled compile
./piled run
```
#### REPL
```console
./piled
```
Just compile this project and run `./piled`.