Skip to content
项目

关于

The Toy Scripting Language. Mirrored nightly.

编程语言与运行时

这些数字如何统计

可以做什么

  • Simple C-like syntax
  • Intermediate AST and bytecode representations
  • Strong, but optional type system
  • First-class functions and closures

实测星标增长

24小时
+2
7天
+2
15天
+3
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

The Toy Logo

Toy v2-beta

The Toy Scripting Language is an imperative, bytecode-interpreted, embeddable scripting language. Rather than functioning independently, it serves as part of another program, the "host". This design allows for straightforward customization by both the host's developers and end users, achieved by exposing program logic through external scripts.

This repository holds the handmade reference implementation for Toy version 2, written in C - open beta is currently underway.

Nifty Features

  • Simple C-like syntax
  • Intermediate AST and bytecode representations
  • Strong, but optional type system
  • First-class functions and closures
  • Extensible with native C-bindings
  • Can re-direct output, error and assertion messages
  • Open-Source under the zlib license

Syntax

fn makeCounter() {
	var counter: Int = 0;

	fn increment() {
		return ++counter;
	}

	return increment;
}

//'tally' holds internal state
var tally = makeCounter();

for (var result = 0; result < 10; result = tally()) {
	print result;
}

Building

This project requires gcc and make by default, but should also work in other environments. Officially supported platforms include linux, windows and macOS, see source/toy_common.h for implementation details.

Run make in the root directory to build the shared library named libToy.so and a useable REPL named repl.out.

Documentation

The contents of docs/ is also available on the official website toylang.com.

License

This source code is covered by the zlib license (see LICENSE for details).

Contributors and Special Thanks

No AI

Contributions via the GitHub repo are welcome, but absolutely no AI contributions will be accepted.

@ThomasAdam - Multiple fixes to overlooked problems and memory improvements @Jenny-hso - Syntax highlighting for multiple text editors
Suyash Dwivedi - "No AI" logo via wikimedia, CC BY-SA 4.0
@NishiOwO - Unofficial NetBSD support
@Gipson62 - v1 docs spell checking
@8051Enthusiast - fixAlignment() trick
@hiperiondev - v1 Disassembler, v1 porting support and feedback
@add00 - v1 Library support
@gruelingpine185 - Unofficial v1 MacOS support
@solar-mist - v1 Minor bugfixes
Various Anons - Feedback
@munificent - For writing the book that sparked my interest in langdev

Financial Supporters

You can show your support and be listed here by joining my Patreon, or buying me a coffee at ko-fi.

探索相关项目

加载中…