https://github.com/vivekg13186/stack-language
A simple stack based programming langauage
https://github.com/vivekg13186/stack-language
programming-language stack-based
Last synced: 6 months ago
JSON representation
A simple stack based programming langauage
- Host: GitHub
- URL: https://github.com/vivekg13186/stack-language
- Owner: vivekg13186
- Created: 2020-05-13T17:26:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-13T17:44:53.000Z (over 5 years ago)
- Last Synced: 2025-03-29T13:51:46.243Z (10 months ago)
- Topics: programming-language, stack-based
- Language: C++
- Size: 44.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Welcome to Stack Programming Language
Basic programming with few commands.
# Commands
| Command | Description | Example|
| ----------- | ----------- |----------- |
| push | push a number on to stack | push 23|
| pop | pop a number from stack | pop|
| + | add last two numbers in stack | +|
| - | subract last two numbers in stack | -|
| * | multiply last two numbers in stack | * |
| / | divide last two numbers in stack | /|
| % | modulo last two numbers in stack | %|
| > | compare last two numbers in stack | >|
| < | compare last two numbers in stack | <|
| >= | compare last two numbers in stack | <= |
| <= | compare last two numbers in stack | >=|
| != | compare last two numbers in stack | !=|
| == | compare last two numbers in stack | ==|
| jmp | jump code to given line number | jmp 23|
| jmpt | jump code to given line number if last stack value is zero | jmpt 23|
| jmpf | jmp code to given line number if last stack value is not zero | jmpf 23 |
| print | prints last stack value | print|
| get | wait for user to enter value and push to stack | get|
| dup | duplicate last value in stack | dup|
| exit | exit the program | exit|
## How to build
- Build with single file "stack.cpp".
- Supports all platform.
- No external dependency.
- Check compile.sh file for reference.
## How to run
stack <-p> <-d>
- option -p print the complied code
- option -d for debugging, execute each step on keypress.
## Examples
Sample file in test folder