Quetite is a small interpreted scripting language with a friendly, Ruby-like syntax, dynamic typing, and an stdlib of native helpers. It is implemented as a classic three-stage interpreter (lexer -> parser -> evaluator) in Rust.
println("Hello Quetite!")Warning
Quetite is still a WIP (work in progress) language. Expect breaking changes!
- Easy and familiar scripting language syntax, no semicolons, no indentation rules
- Fully dynamic type system (with types like
Bool,Num,Stretc...) - First class functions (
Callabletype) and objects with constructors, static and bound methods (Objtype) - Fully dynamic lists and dictionaries (
ListandDicttypes) - Internal prototype methods on primitives (
Str.len(),List.push(),Dict.keys(), etc.) - Familiar control flow:
if/else,while,forover iterables,match - Friendly and easy to understand errors!
- Runtime error handling system via
throwandtry/catch/ensure - Misc scripting features such as: ranges (
..and..=operators), list/string slicing (str[a..b]), nullish coalescing (a ?? b), power (a**b) and ternary (cond ? a : b) operators - Truthiness rules (
false,Null,0are falsy; everything else is truthy) - Powerful and extensive stdlib (
Sys,Math,Rand,Termetc.) - Ability to include other scripts inside a script via
use - Fully interactive REPL with interactive
helpcommand - Ratatui bindings for the stdlib to create fun TUI apps! (half implemented, full implementation coming soon!)
- Processing/p5.js like simple creative coding and graphics API for the stdlib to create fun games and creative programs! (half implemented, full implementation coming soon!)
Prereqs: Rust toolchain installed via rustup.
Build and run a script:
cargo run path/to/script.qteRun the example snake.qte:
cargo run examples/snake.qteRun the interactive REPL:
cargo runUse the help command inside the REPL to interactively explore "The Quetite Language Reference" and "API Reference" documentations. Also check out the examples folder to see other examples!
println("Rock Paper Scissors in Quetite!")
var moves = ["rock", "paper", "scissors"]
var beats = {
"rock": "scissors",
"paper": "rock",
"scissors": "paper"
}
while true do
print("\nMake your move: ")
var user = read()
if user == "q" break
if !moves.contains(user) do
print("Invalid move! Valid moves are: ")
println(moves)
continue
end
var computer = Rand.list(moves)
println("\nYour move: " + user)
println("Computer's move: " + computer)
if beats[computer] == user println("\nComputer wins!")
if beats[user] == computer println("\nYou win!")
if user == computer println("\nIt's a draw!")
endSee "The Quetite Language Reference" for a full list and detailed explanations of Quetite's features.
-
Values & Prototypes
type(),type_of(),type_check()on any value; conversions viato_*()helpers. -
Strings
Indexing and slicing;len(),repeat(n), and terminal color/style helpers. -
Lists
Dynamic arrays withlen(),push(),pop(),insert(i, v),remove(i),first(),last(),contains(v). -
Dicts
Hash maps keyed byNull/Bool/Num/Str;len(),contains(k),insert(k, v),remove(k),get(k),keys(),values(). -
Control Flow
if/else,while,for value, index in iterable,match, ternarycond ? a : b, rangesa..banda..=bwith optionalstep, slicing with ranges. -
Errors
try/catch/ensureandthrow; internal error types includeTypeErr,NameErr,ArityErr,ValueErr,NativeErr,IOErr,UserErr. -
Objects & Functions
First-class functions; objects with optionalinit()constructor, static methods, and bound methods usingself.
examples- example Quetite scriptssrc/lexer- tokenizersrc/parser- recursive descent parser producing ASTsrc/evaluator- tree-walk interpreter and stdlib nativesREFERENCE.md- full language reference
