Skip to content

EvilStack is a stack-based programming language that has familiar syntax and has similar commands to assembly. It is still in development and is not yet feature-complete. It is made for fun and educational purposes.

License

Notifications You must be signed in to change notification settings

TheCodeHeist/evilstack-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EvilStack Language


About

EvilStack is a stack-based programming language that has familiar syntax and has similar commands to assembly. It is still in development and is not yet feature-complete. It is made for fun and educational purposes.

Commands

The features for heap and memory access are not yet implemented.

Stack Manipulation

  • push - Pushes the value to the stack
  • pop - Pops the value from the stack
  • dup - Duplicates the top value from the stack
  • swap - Swaps the top two values from the stack

Binary Operations

  • add - Adds the top two values from the stack
  • sub - Subtracts the top value from the second top value
  • mul - Multiplies the top two values from the stack
  • div - Divides the second top value by the top value
  • mod - Divides the second top value by the top value and pushes the remainder

Data Manipulation

  • atoi - Converts the top string value from the stack to an integer
  • ftoi - Converts the top float value from the stack to an integer

Flow Control

  • <label>: - Labels are used to mark a position in the program
  • cmp - Compares the top two values from the stack
  • jmp @<label> - Jumps to the label
  • jeq @<label> - Jumps to the label if the top two values are equal
  • jne @<label> - Jumps to the label if the top two values are not equal
  • jgt @<label> - Jumps to the label if the second top value is greater than the top value
  • jlt @<label> - Jumps to the label if the second top value is less than the top value
  • jge @<label> - Jumps to the label if the second top value is greater than or equal to the top value
  • jle @<label> - Jumps to the label if the second top value is less than or equal to the top value
  • ret - Returns from a subroutine
  • exit - Exits the program

I/O

  • print - Prints the top value from the stack
  • read - Reads a value from the input and pushes it to the stack

Built-in Functions

  • rand - Pushes a random number to the stack

About

EvilStack is a stack-based programming language that has familiar syntax and has similar commands to assembly. It is still in development and is not yet feature-complete. It is made for fun and educational purposes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages