Tinytalk
A purely object-oriented toy programming language
Install / Use
/learn @rdococ/TinytalkREADME

Animal := [new
health := 100.
[die
health <- 0.
|health
health]].
Cat := [new
[makeSound
console print: 'Meow!'.
| ...Animal new]].
Dog := [new
[makeSound
console print: 'Woof!'.
| ...Animal new]].
peppy := Cat new.
peppy makeSound. "This will print 'Meow!'"
console print: peppy health. "100"
A purely object-oriented toy language, demonstrating how OOP does not need inheritance, traditional classes or prototypes.
Semantics
Imperative and sequential. You can:
- Define and mutate variables.
- Create an object by defining a set of method closures.
- While defining an object, copy in another object's methods. (Variable references are early-bound, i.e. no open recursion.)
- Create a block, an object with a single
domethod with special return semantics. - Perform an early return, exiting from the innermost lexical non-block method.
Syntax
Operator precedence is not finalized, but is currently as follows:
- Unary messages have the highest precedence.
3 factorial + 4means(3 factorial) + 4. - Binary operators are next, and left-associative.
3 + 4 * 5 min: 2means((3 + 4) * 5) min: 2. - Keyword messages are last and also left-associative.
Expressions can be sequenced with ., returning the value of the last expression evaluated.
Object literals are defined with [] enclosing a set of methods and decorations, separated by |. A method consists of a method signature and a sequence of expressions. A decoration is defined with ...<expr>.
A block can be defined with {} and contains a single expression. An early return may be constructed with ^ <expr>.
Utilities
There are several objects built into the language.
- Numbers, strings and booleans implement a variety of operators. Strings can
importthe file with their name in the repository, e.g.'brainfuck' import. - Booleans implement
if:, sendingtrueorfalse. - The
consolecanreadinput,print:orwrite:output, or throw anerror:. - The
Arrayobject can createnewarrays, that can get valuesat:a position, orat:Put:. - The
systemcanrequire:tinytalk code oropen:files. Files canreadlines,readAll,write:, get theirpositionandsize,goto:,move:andclose.
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
