The language that eats the stack. Heavily inspired by porth which is inspired off of forth

Related tags

Miscellaneous snack
Overview

Snack

The language that eats the stack. Heavily inspired by porth which is inspired off of forth

Install

To use Snack you will need Rust and fasm After installing Rust just run

git clone https://github.com/cowboy8625/snack
cd snack/snackc
cargo run --release -- run 
   

   

or to install

cargo install --git https://github.com/cowboy8625/snack

Snackc Args

Args can be stacked.

run           Compiles and runs file.
--debug       Gives debug output to assembly file.

and you all set.

Snackc Commands

Build snackc

Build & Run snackc run

Syntax

Hello World

"Hello World!\n" 1 1 syscall3

Looping and Conditions

0 while copy 10 <= do
copy 0 == if
100 .
copy 1 == elif
200 .
copy 2 == elif
300 .
copy 3 == elif
400 .
else
copy .
end
1 +
end

Stack Commands

Name Description
copy Copy's top of stack
swap Swap's top two items on stack with each other.
drop Drop's top item from stack.
. Print's number from top of stack (Works with numbers only)
over Copy's second from top item on stack.
rot Rotate's top three items on stack.
max Take top two items on stack and place max value back on top.

Operators

name Description
== Check for Equality of two items and places bool on top of stack
!= Check for Not Equal of two items and places bool on top of stack
> Check which is Greater of two items and places bool on top of stack
< Check which is Less of two items and places bool on top of stack
>= Check which is Greater or Equal of two items and places bool on top of stack
<= Check which is Less or Equalof two items and places bool on top of stack
+ Addes top two items on stack and places Result back on stack
- Subtracts top two items on stack and places Result back on stack
* Multiply top two items on stack and places Result back on stack
/ Divide top two items on stack and places Result back on stack
% Mod top two items on stack and places Result back on stack

Memory

name Description
memory Push's memory address on stack
! Stores a single byte from a address on the stack.
@ Loads a single byte from address on stack.

Syscall's

name arg1 arg2 arg3
syscall3 message size message location File Descriptor

How it works (Or Will)

Linking

Take some of the naming with a grain of salt.

Linking happens after the file is turned into tokens well all but the while loops do get linked to there end block in the lexing process.

A link is just the tokens idx number so a jump in a condisional statement would be like this.

1 0 if
100 .
else
200 .
end

in the assembly we put a place to jump into the else block.

; check if we run if statement else we jump to the else block
filename5:   ;←  this is the else starting point
push  200
pop   rdi
call  print
filename8:   ;←  this is the end starting point

Blocks are labeled with the filename stripped of any -, /, \\ followed by the block index number.

You might also like...
Open Source Application Stack & PaaS

mycelia Open Source Application Stack & PaaS Installation cargo xtask build NOTE: We opted for cargo-xtask because Cargo build.rs is not supported for

osu-link is a program which links osu!stable beatmaps to osu!lazer's new store format, saving you disk space.

osu-link is a program which links osu!stable beatmaps to osu!lazer's new store format, saving you disk space.

Buildomat manages the provisioning of ephemeral UNIX systems on which to run software builds
Buildomat manages the provisioning of ephemeral UNIX systems on which to run software builds

B U I L D O M A T a software build labour-saving device Buildomat manages the provisioning of ephemeral UNIX systems (e.g., instances in AWS EC2) on w

Simple tray application which shows battery level for HyperX Cloud Flight Wireless Headset.
Simple tray application which shows battery level for HyperX Cloud Flight Wireless Headset.

HyperX Cloud Flight Battery Monitoring Introduction Simple tray application which shows battery level for HyperX Cloud Flight Wireless Headset. Screen

📦  Crate Protocol allows anyone to create, manage, and trade a tokenized basket of assets, which we refer to as a Crate.
📦 Crate Protocol allows anyone to create, manage, and trade a tokenized basket of assets, which we refer to as a Crate.

📦 Crate Protocol Crate Protocol allows anyone to create, manage, and trade a tokenized basket of assets, which we refer to as a Crate. A Crate is alw

TAT agent is an agent written in Rust, which run in CVM or Lighthouse instances.

TAT agent is an agent written in Rust, which run in CVM, Lighthouse or CPM 2.0 instances. Its role is to run commands remotely without ssh login, invoked from TencentCloud Console/API. Commands include but not limited to: Shell, PowerShell, Python. TAT stands for TencentCloud Automation Tools. See more info at https://cloud.tencent.com/product/tat.

Pbot - pan93412's extensible userbot, which is full-documented, enginnered and based on Actor model.

pbot pan93412's extensible user bot, which is full-documented, engineered and based on Actor model. Usage Run cargo run --release [--features modules

A Rust proc-macro crate which derives functions to compile and parse back enums and structs to and from a bytecode representation

Bytecode A simple way to derive bytecode for you Enums and Structs. What is this This is a crate that provides a proc macro which will derive bytecode

Ampseer examines reads in fastq format and identifies which multiplex PCR primer set was used to generate the SARS-CoV-2 sequencing library they are read from.

Ampseer examines reads in fastq format and identifies which multiplex PCR primer set was used to generate the SARS-CoV-2 sequencing library they are read from.

Owner
Cowboy8625
I started really learning how to program in Jan of 2018 in Python. Rust and Vim are my main thing now.
Cowboy8625
The most primitive and the fastest implementation of a fixed-size last-in-first-out stack on stack in Rust, for Copy-implementing types

This is the simplest and the fastest (faster than Vec!) implementation of a last-in-first-out stack data structure, on stack, when stack elements are

Yegor Bugayenko 10 Jun 18, 2023
Turn off monitors to save power (for Wayland)

Same as xset dpms force off, but for Wayland. It requires zwlr_output_power_manager_v1 and org_kde_kwin_idle support from the Wayland compositer. wlro

依云 15 Dec 8, 2022
Very simple Rust binary that can turn on/off a TP-Link L920 led light strip in your local network

TP-Link L920 on/off script This is a (very) simple Rust binary that can turn on/off a TP-Link L920 led light strip in your local network. Installation

Luciano Mammino 3 Aug 21, 2023
Ruxnasm is an assembler for Uxntal — a programming language for the Uxn stack-machine by Hundred Rabbits

Ruxnasm is an assembler for Uxntal — a programming language for the Uxn stack-machine by Hundred Rabbits. Ruxnasm strives to be an alternative to Uxnasm, featuring more user-friendly error reporting, warnings, and helpful hints, reminiscent of those seen in modern compilers for languages such as Rust or Elm.

Karol Belina 44 Oct 4, 2022
Programming language from down under, inspired by this Reddit post.

aussie++ Programming language from down under, inspired by this Reddit post. View live demo here. Special thanks to MarkWhyBird, louis100, and others

Zack Radisic 562 Dec 27, 2022
Programming Language Inspired by Brainfuck

Brainsuck Brainfuck but not really... like... a better version of it. Installation Requirements: Rust version 1.50 or higher Linux curl https://raw.gi

Derin Önder Eren 27 Nov 18, 2022
A Star Wars inspired by programming language

The Force The Force is a gateway to abilities many believe are unnatural... Getting Started Install Rust. We also provide a Dev Container if you would

Matthew Booe 14 Dec 21, 2022
Symbolically Executable Stack Machines in Rust

Symbolically Executable Stack Machines in Rust Symbolic Stack Machines is a library for implementing symbolically executable stack-based virtual machi

TannrA 64 Dec 28, 2022
A toy-level BLE peripheral stack

bleps - A toy-level BLE peripheral stack This is a BLE peripheral stack in Rust. (no-std / no-alloc) To use it you need an implementation of embedded-

Björn Quentin 4 Oct 17, 2022
Source code and documentation for our 'full stack on rust' meetup on 29-9-2022

Full stack on Rust This is the code and documentation repository for our 'Full stack on Rust' meetup on 29-9-2022. It includes step-by-step documentat

Baseflow 7 Oct 23, 2022