Skip to content

vivekg13186/Stack-Language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simple stack based programming langauage

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published