https://github.com/ellipticobj/alpha
stack based programming language
https://github.com/ellipticobj/alpha
programming-language stack-based-language
Last synced: 6 months ago
JSON representation
stack based programming language
- Host: GitHub
- URL: https://github.com/ellipticobj/alpha
- Owner: ellipticobj
- License: gpl-3.0
- Created: 2025-01-27T05:01:51.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-11T04:10:02.000Z (12 months ago)
- Last Synced: 2025-03-20T06:38:14.116Z (10 months ago)
- Topics: programming-language, stack-based-language
- Language: Python
- Homepage:
- Size: 16.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# alpha
a stack based programming language
# why make this?
i was watching a youtube video (i forgot the name sorry :(..), i got inspired by it to create this. additionally, since i had a school project coming up where i had to create a programming language, i thought itd be a great idea to get the feels of it by starting with this simpler project.
# roadmap
quit command
input command
macros
multiple stack support
variable support
# building
run build.sh (*nix only)
# syntax
## push
```
PUSH
```
pushes to the stack
## math
```
ADD
SUB
MUL
DIV
```
does an operation on the top two elements of the stack
## print
```
PRINT
```
prints the top element of the stack
## pop
```
POP
```
removes the top element of the list
## dump
```
DUMP
```
clears the stack and prints everything
## duplicate
```
DUP
```
duplicates the top element and adds it to the stack
## swap
```
SWAP
```
swaps the top two elements of the stack
## depth
```
DEPTH
```
returns the depth of the stack
## stack
```
STACK
```
returns the entire stack, like DUMP but it doesnt purge the stack
## drop
```
DROP
```
purges the stack, like DUMP but it doesnt return the stack
## rot
```
ROT
```
rotates the top three elements of the stack:
[1, 2, 3] ROT => [2, 3, 1]
## jump, label
```
LABEL labelname
JUMP labelname
```
`JUMP` makes the code skip everything between it and `LABEL`
can be used to make infinite loops
## if else
```
IF
PUSH true
ELSE
PUSH false
ENDIF
```
if statement executes the code between it and else if the top element in the stack is true
if statements need an endif
## greater than, less than, equals to
```
GT
LT
EQ
```
these operators pop the top two elemnts and add the result to the stack