A dynamically typed, interpreted, stack-based language.

Overview

Stacc

A dynamically typed, interpreted, stack-based language.

How does it work?

Each call-frame/scope has its own variables and stack, so you can get/set variables and push/pop from the stack.

Here are all the different types of statements in the language:

  • Function definition - begin fn_name: param1 param2 end
  • Variable declaration (sets variable in current scope) - set var_name 123
  • Push (pushes value onto current stack) - push 123
  • Pop (pops value from stack and discards it) - pop / set a pop
  • Print - print "Hello World!"
  • Function call (pops argument values from parent stack, and pushes result onto parent stack) - call do_thing

Here are all the different types of expressions in the language:

  • Identifier - gets value
  • Literal - integer, float or string literal
  • Binary operation - arithmetic (+, -, *, /) or comparison (<, >, <=, >=, ==, !=) expression
  • Unary operation - prefix - or prefix not
  • Pop (pops the value at the top of the stack and returns it) - pop

Note: the result of a function is either the value at the end of its stack or if the stack is empty, nothing and statements must be proceeded by newlines

Code Examples?

In the aptly named examples directory of the repo.

How do I use the executable?

  • stacc to get a repl
  • stacc to run the interpreter on a file
You might also like...
A small scripting language running on V8.

Rook A small scripting language running on V8. After spending a few hours playing with V8, it seems like the only way to make this work is by transpil

Yet Another Programming Language

Yet Another Programming Language

🐱‍👤 Cross-language static library for accessing the Lua state in Garry's Mod server plugins

gmserverplugin This is a utility library for making Server Plugins that access the Lua state in Garry's Mod. Currently, accessing the Lua state from a

luau bindings for the Rust programming language

🌔 luau-rs Luau bindings for the Rust programming language using bindgen ⚠️ Disclaimer This does not provide bindings for everything as luau does not

Program analysis playground for a simple, imperative language
Program analysis playground for a simple, imperative language

Proggers Proggers is a program analysis playground for a simple, imperative language. Features Numerical analysis using abstract interpretation Type-c

Czech for the Rust programming language
Czech for the Rust programming language

rez Nejsi you tired from writing Rust programs in English? Do you like saying do prdele or pivo a lot? Would you like to try something different, in a

The official home of the Nyson Programming Language, built off Rust.
The official home of the Nyson Programming Language, built off Rust.

Nyson Programming Language The official home of the Nyson Programming Language, built off Rust. (created by Nyelsonon and AMTitan, 2021) Advertisement

The programming language for scalable development

Pen programming language Pen is the programming language that makes software development scalable, focusing on software maintainability and portabilit

A newborn programming language for extensible software

A newborn programming language for extensible software.

Owner
I do too many random things to fit into a bio
null
Lagoon is a dynamic, weakly-typed and minimal scripting language. 🏞

Lagoon is a dynamic, weakly-typed and minimal scripting language. It draws inspiration from a handful of modern languages including JavaScript, Rust and PHP.

Ryan Chandler 25 Jul 5, 2022
Dc improved: Feature-added rewrite of a 50+ year old RPN calculator/stack machine/programming language

dcim [WIP] dc improved: Feature-added rewrite of a 50+ year old RPN calculator/stack machine/programming language This readme is currently incomplete.

null 3 Jun 18, 2022
Stack unwinding library in Rust

Unwinding library in Rust and for Rust This library serves two purposes: Provide a pure Rust alternative to libgcc_eh or libunwind. Provide easier unw

Gary Guo 51 Nov 4, 2022
Rust bindings for accessing the Go containers/image stack

Rust bindings for accessing the Go containers/image stack This crate contains a Rust API that forks /usr/bin/skopeo and talks to it via a custom API.

Containers 16 Dec 26, 2022
Rust bindings for accessing the Go containers/image stack

Rust bindings for accessing the Go containers/image stack This crate contains a Rust API that forks /usr/bin/skopeo and talks to it via a custom API.

Colin Walters 1 Oct 15, 2021
A shell scripting language

Slash The system level language for getting the job done. Detailed documentation is available on the Slash site Motivation Bash is an awesome shell, b

null 27 Jun 17, 2022
An interactive scripting language where you can read and modify code comments as if they were regular strings

An interactive scripting language where you can read and modify code comments as if they were regular strings. Add and view text-based visualizations and debugging information inside your source code file.

Sumeet Agarwal 13 Apr 28, 2022
A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

null 1.4k Jan 1, 2023
Tyrade: a pure functional language for type-level programming in Rust

A pure functional language for type-level programming in Rust

Will Crichton 286 Jan 1, 2023
An OOP programming language I am making by following Crafting Interpreters.

horba An OOP programming language I am making by following Crafting Interpreters. https://craftinginterpreters.com/ I intend it to have a somewhat C-s

Thomas 3 Dec 5, 2021