Tender
Tender is a general-purpose programming language specially designed for image processing, 2D graphics, scripting, and more! Here is a quick tutorial.
Overview
Tender compiles into bytecode and executes on a stack-based virtual machine (VM) written in native Golang.
Features
- Simple and highly readable syntax
- Compiles to bytecode
- Supports rich built-in functions
- Includes an extensive standard library
- Optimized for 2D graphics
Supported Standard Library
- math: Mathematical constants and functions
- os: Platform-independent interface to OS functionality
- strings: String conversion, manipulation, and regular expressions
- times: Time-related functions
- rand: Random number generation
- fmt: Formatting functions
- json: JSON handling functions
- base64: Base64 encoding and decoding
- hex: Hexadecimal encoding and decoding
- colors: Functions to print colored text to the terminal
- gzip: Gzip compression and decompression
- zip: ZIP archive manipulation
- tar: TAR archive creation and reading
- bufio: Buffered I/O functions
- crypto: Cryptographic functions
- path: File path manipulation
- image: Image manipulation
- canvas: Drawing functions for canvases
- dll: Dynamic link library interactions
- io: Input and output functions
- audio: Audio processing
- net: Networking functions
- http: HTTP client and server utilities
- websocket: WebSocket communication utilities
- gob: Gob Encoding/Ddecoding
- csv: CSV Encoding/Ddecoding
Quick Start
- Install Tender on your machine.
- Copy the sample code below:
// Basic example
str1 := "hello"
str2 := "world"
println(str1 + " " + str2)
// Canvas drawing example (similar to JS Canvas)
import "canvas"
var ctx = canvas.new_context(100, 100)
ctx.hex("#0f0") // Set color to green
ctx.dash(4, 2) // Define dashed stroke
ctx.rect(25, 25, 50, 50) // Draw a rectangle
ctx.stroke()
ctx.save_png("out.png") // Save output as PNG
- Save your code as
hello.td
(use the.td
extension). - Run your script using the following command:
tender hello.td
Installation
Using Go
- Install the latest version of Go.
- Run the following command to install:
go install github.com/2dprototype/tender/cmd/tender@latest
Manual Installation (Windows)
Precompiled binaries are available. Download them from the release tags.
Documentation
Examples
Explore various examples demonstrating Tender’s features in the examples directory.
Dependencies
Tender uses the following dependencies:
Syntax Highlighting
Syntax highlighting is currently available only for Notepad++. Download the configuration file here.
License
Tender is distributed under the MIT License, with additional licenses provided for third-party dependencies. See LICENSE_GOLANG and LICENSE_TENGO for more information.
Acknowledgments
Tender is written in Go, based on Tengo. We extend our gratitude to the contributors of Tengo for their valuable work.