An elegant language for script-kiddies and terminal squatters.

Related tags

Command-line tonic
Overview

Tonic

An elegant language for script-kiddies and terminal squatters.

About

I started Tonic to complete the Advent of Code 2021. My eventual goal is to make this a viable language for writing shell scripts and other small utilities too.

At the minute it's pretty barebones and could do with a huge performance boost. A recursive fib(30) function takes roughly 1.5 seconds to complete, which isn't great.

Contributing

If you would like to contribute, please feel free to take a look at some of the issues or perhaps did through the code and find some better ways to do things. I'm still fairly new to the programming language thing so any help and criticism is welcome.

Comments
  • Advent of Code 2020

    Advent of Code 2020

    Ahead of Advent of Code 2021, I want to try and complete at least 5 of last year's challenges. It'll help me find things that are missing from the language and runtime.

    Days:

    • [x] Day 1
    • [x] Day 2
    • [x] Day 3
    • [ ] Day 4
    • [ ] Day 5

    I'll use this pull request to keep track of things I want to add and will likely add them in as part of this pull request too.

    Features

    • [x] An @std/fs module for reading files
    • [x] Single-expression closures, probably similar to PHP (fn () -> [...])
    • [x] Shortcut assignment operators (+=, -=, *=, /=, etc)
    • [ ] Rename .forEach(...) to each(...)
    • [ ] A better string-split function that defaults to splitting by an empty string
    opened by ryangjchandler 2
  • feature: js compiler

    feature: js compiler

    Tonic is taking a new direction now and instead of writing our own virtual machine and optimising for performance, we'll instead take a Tonic-to-JS compiler approach and use an embedded JS machine instead. These machines are far more featureful than anything I could write right now.

    The engine in use is QuickJS, using the rquickjs crate for bindings. This crate has support for class definitions based on Rust structs (although no luck getting them to work yet), but the API is quite solid.

    Right now it's all about getting the language API solid.

    opened by ryangjchandler 0
  • feature: closures

    feature: closures

    Closes #16.

    This is quite a dirty way of doing I feel. We essentially create a special opcode for closures. This code will take the environment of the current frame and store it inside of the closure value so that it can be restored (set with frame) when called later on.

    When we move to stack offsets, we'll likely need to capture those stack offsets instead.

    opened by ryangjchandler 0
  • feature: function hoisting

    feature: function hoisting

    Adds support for function hoisting, meaning all function definitions are placed at the top of the AST, e.g.

    dbg(name())
    
    fn name() {
        return "Ryan"
    }
    

    This will now work as name() is defined before the dbg() call. This is the simplest way to make this work, an alternative way of doing this would be creating a pseudo-main function that is wrapped around all procedural statements instead. That could be a potential refactor later on, but this is good for now.

    opened by ryangjchandler 0
  • Advent of Code 2021

    Advent of Code 2021

    Writing all of the AoC 2021 solution in Tonic this year.

    • [x] Day 1 (https://github.com/ryangjchandler/tonic/pull/60/commits/c7497e0a64a78a2f5c0e1b38e4f02507e476aa46, https://github.com/ryangjchandler/tonic/pull/60/commits/bfd4825f0071a94043f0d46e960aab89e45d85e8)
    • [x] Day 2 (https://github.com/ryangjchandler/tonic/pull/60/commits/e3ff10779d8c7ec90e613af33340d332ba193119, https://github.com/ryangjchandler/tonic/pull/60/commits/0ba9cc790ff494f13be6b952eb0938ee6dd809ba)
    • [ ] Day 3
    • [ ] Day 4
    • [ ] Day 5
    • [ ] Day 6
    • [ ] Day 7
    • [ ] Day 8
    • [ ] Day 9
    • [ ] Day 10
    • [ ] Day 11
    • [ ] Day 12
    • [ ] Day 13
    • [ ] Day 14
    • [ ] Day 15
    • [ ] Day 16
    • [ ] Day 17
    • [ ] Day 18
    • [ ] Day 19
    • [ ] Day 20
    • [ ] Day 21
    • [ ] Day 22
    • [ ] Day 23
    • [ ] Day 24
    • [ ] Day 25
    opened by ryangjchandler 0
Releases(v0.3.0)
  • v0.3.0(Nov 24, 2021)

    The Tonic Programming Language

    This is the first semi-stable release of Tonic. The Tonic-to-JavaScript compilation is fairly solid and I've implemented a few nice features.

    The standard library also has some cool modules available, e.g. a micro-framework for web applications, a very basic HTTP server, etc.

    Going forward, all things will be tagged and released accordingly and release notes will contain information about the changes made.

    Source code(tar.gz)
    Source code(zip)
Owner
Ryan Chandler
Ryan Chandler
Replace an app's icon from a png with a single terminal script. Made with Rust

Replace macOS App Icon Replace an app's icon from a png with a single terminal CLI. Made with Rust

Kunal Bagaria 8 Aug 3, 2022
❗️ Small script to view GitHub notifications in the terminal

github-notifications Small script to view GitHub notifications in the terminal Shows and color-codes the notification source, eg if you're the owner o

Brian Shaginaw 1 Jan 10, 2022
Ask ChatGPT for a shell script, code, or anything, directly from your terminal 🤖🧠👨‍💻

ShellGPT Ask ChatGPT for a shell script, code, or anything, directly from your terminal ?? ?? ??‍?? Demo Install The binary is named gpt when installe

null 4 May 15, 2023
Wena is a micro-framework that provides an elegant starting point for your console application.

Wena was created by Nuno Maduro, and is a Rust Lang micro-framework that provides an elegant starting point for your console application. This project

null 251 Dec 11, 2022
lla - The Elegant ls Alternative

lla - The Elegant ls Alternative Overview lla (Lightweight ls Alternative) is an elegant and efficient command-line utility written in Rust, designed

Mohamed Achaq 4 Jul 31, 2023
A bit like tee, a bit like script, but all with a fake tty. Lets you remote control and watch a process

teetty teetty is a wrapper binary to execute a command in a pty while providing remote control facilities. This allows logging the stdout of a process

Armin Ronacher 259 Jan 3, 2023
Fast KubeJS script manager. Includes version control and compatibility with KJSPKG packages.

CarbonJS A KubeJS script manager Features ?? Super fast ⚙️ Version control ?? Constantly new scripts being added ✅ Easy to use ?? Compatibility with K

Krzysztof Poręba 3 May 9, 2023
A tool that allows you to modify, edit, and recompile the AST script of Artemis engine.

Artemis AST Script Processor This utility offers a set of Rust functions to parse and manipulate Artemis AST-based scripts. Features Tokenization: Con

xmoe 7 Sep 19, 2023
comfy is a flexible command script manager / runner written in Rust

comfy is a cross-platform command script manager / runner tool, which allows you to run commands in the command line itself, but being these predefined in a portable and universal .comfy file.

daCoUSB 17 Nov 12, 2021
Cargo script subcommand

cargo-script cargo-script is a Cargo subcommand designed to let people quickly and easily run Rust "scripts" which can make use of Cargo's package eco

Daniel Keep 643 Jan 3, 2023
Nvm - Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions

Node Version Manager Table of Contents Intro About Installing and Updating Install & Update Script Additional Notes Troubleshooting on Linux Troublesh

nvm.sh 63.8k Jan 7, 2023
Write a simple CLI script, that when given a 64-byte encoded string

Write a simple CLI script, that when given a 64-byte encoded string, it finds a suitable 4-byte prefix so that, a SHA256 hash of the prefix combined with the original string of bytes, has two last bytes as 0xca, 0xfe. Script should expect the original content of the string to be passed in hexadecimal format and should return two lines, first being the SHA256 string found and second 4-byte prefix used (in hexadecimal format).

Andy Bell 0 Feb 4, 2022
A Rust-based shell script to create a folder structure to use for a single class every semester. Mostly an excuse to use Rust.

A Rust Course Folder Shell Script PROJECT IN PROGRESS (Spring 2022) When completed, script will create a folder structure of the following schema: [ro

Sebastián Romero Cruz 1 Apr 10, 2022
A small script to facilitate the making of .src.spm.tar.gz packges

SPM-Helper Rust version: Installation PYTHON: install python and git Clone the repo with this command: git clone -b Python https://github.com/Soviet-L

Soviet Linux 3 Jun 24, 2022
Fix the simple rust script as shown in README.md

Rust Fix Me Steps Create a Github account. (If you already have one no issues) Star this repository. Fork this repository to your Github account. Clon

Ganesh Chandrasekaran 48 Dec 9, 2022
A standalone Luau script runner 🌙

Lune ?? A standalone Luau script runner ?? Use the ergonomics and readability of Luau for your shell scripts ?? ⚙️ Installation The preferred way of i

Filip Tibell 13 Feb 2, 2023
A small script in rust to get the cpu usage in %'s with a gradient color for the text

cpu_usage-polybar A small script in rust to get the cpu usage in %'s with a gradient color for the text To get it to work on your PC you will have to

Sara 4 Apr 18, 2023
Animated app icons in your Dock that can run an arbitrary shell script when clicked.

Live App Icon for Mac Animated app icons in your Dock that can run an arbitrary shell script when clicked. Requirements macOS 13 (Ventura) or higher X

Daichi Fujita 13 Jun 8, 2023
Opinionated set of extensions for use with rust-script

rust-script-ext Opinionated set of extensions for use with rust-script. Using rust-script to run Rust like a shell script is great! This crate provide

Kurt Lawrence 13 Sep 3, 2023