Learn Langoost
Everything about the language as it takes shape — from a first
Hello, world to structured concurrency. Start with the tour,
then dive into the topics below.
Get started
What is Langoost?
Langoost is a statically-typed scripting language that compiles to bytecode and runs on a fast stack-based VM. Built for backend scripting — like PHP, but with no per-request cold start.
Read →Install & run
How to build Langoost from source with Go and run your first .goost script, start the REPL, or launch the persistent execution server.
Read →Language
Language tour
A fast tour of Langoost syntax — variables, types, functions, control flow, arrays, objects, template strings, classes, and error handling, with runnable examples.
Read →Types & values
Langoost's value types — int, float, bool, string, array, object, void/nil, any, and the json/yaml/xml data types — plus number literals, template strings, and conversion.
Read →Functions
Functions in Langoost — declarations, optional type annotations, anonymous functions and closures, variadic parameters, the spread operator, recursion, and hoisting.
Read →Value methods
Built-in methods you can call directly on Langoost values — string methods, array methods, and numeric methods on int, float, and bool.
Read →Classes & types
Object-oriented Langoost — class declarations, methods, single inheritance with extends and super, named type declarations, and object construction.
Read →Control flow
Conditionals and loops in Langoost — if / else if / else, while, for..in over arrays and ranges, and the break and continue loop-control keywords.
Read →Arrays
Working with arrays in Langoost — literals, indexing, negative indices, the append built-in, and the full set of array methods like map, filter, reduce, push, and sort.
Read →Error handling
Handling errors in Langoost with try, catch, throw, and defer, plus the runtime.error and runtime.panic helpers.
Read →Modules & imports
Importing standard-library and local modules in Langoost — namespace imports, named imports, sub-module access, and module resolution order.
Read →Backend
HTTP server
Build an HTTP API in Langoost with http.serve and a handler function that receives method, path, query, and body, and returns a string response.
Read →Concurrency
Concurrency in Langoost with the thread module — spawning goroutines, async futures, channels, mutexes, and sharing state across isolated VMs.
Read →Web libraries
Pure-Langoost libraries for serving HTTP with Request/Response types, WebSockets, Server-Sent Events, cookies, and signed sessions.
Read →Execution server
The langoost server HTTP API — POST /execute to run inline source or a .goost file, GET /health for status, and DELETE /cache to clear the module cache.
Read →Standard library
Standard library overview
Index of the Langoost standard library — text, data, encoding, math, collections, time, filesystem, OS, networking, crypto, data stores, and concurrency modules.
Read →strings
String utilities — search, slice, split, join, replace, trim, case, padding, classification, formatting, and a string builder.
Read →regex
Regular expressions in Langoost — match, find, findAll, replace, split, capture groups, and pattern validation.
Read →types
Runtime type checks and conversions for int, float, bool, char, string, and null/void.
Read →json
Parse, query, edit, merge, and pretty-print JSON, plus streaming parse of arrays and NDJSON.
Read →yaml
Parse and serialize YAML, and convert between YAML and JSON.
Read →xml
Validate, pretty-print, query, and convert XML to JSON or an object tree.
Read →url
Parse and build URLs and query strings, with percent-encoding helpers.
Read →encode
Encoding helpers — base64, hex, CSV, binary integers/floats, and JSON/XML, organized into submodules.
Read →serialize
Binary serialization with msgpack and a simplified protobuf, to and from JSON strings.
Read →compress
Compress and decompress data with gzip, zlib, lz4, and brotli. All I/O is base64.
Read →math
Math utilities — basic arithmetic, trig, logarithms, random, constants, bitwise ops, clamping, and interpolation.
Read →collections
Data structures — stack, queue, set, ordered map, heap, trie, ring buffer, list, tuple, and array helpers.
Read →time
Time and dates — clock, date components, timers/sleep, durations, and formatting, organized into submodules.
Read →date
Convenience date API over Unix timestamps — now, parse, format, component extraction, and arithmetic.
Read →timer
Async timers — setTimeout, setInterval, and clear, with callback functions.
Read →io
Filesystem access — read/write/append files, directories, streaming for large files, and path helpers.
Read →os
Operating-system access — environment, process info, signals, permissions, syscall info, and args.
Read →exec
Run shell commands and programs, read exit codes, and access env and the working directory.
Read →signal
Register POSIX signal handlers (SIGINT, SIGTERM, etc.) with callback functions.
Read →terminal
Terminal/TUI control — raw mode, key reading, size, and ANSI colors, cursor, and screen sequences.
Read →runtime
Runtime introspection and a process-global shared key-value store, plus reflect, error, panic, and env helpers.
Read →memory
Byte buffers, string interning pools, and allocator/GC introspection.
Read →logging
Leveled logging — debug, info, warn, error, fatal — with a global debug toggle.
Read →net
Networking — TCP, UDP, TLS, DNS, and an HTTP client, using integer connection handles.
Read →http
HTTP client — get, post, put, patch, delete, head, status, and a generic request with custom headers.
Read →crypto
Cryptography — hashing, HMAC, AES, RSA, Ed25519, X25519 key exchange, HKDF, secure random, certificates, and TLS info.
Read →redis
Redis client — connect and run key/value, list, hash, and pub/sub commands over integer handles.
Read →sql
SQL databases — open SQLite, Postgres, or MySQL and run exec, query, queryOne, queryValue, and transactions.
Read →mongo
MongoDB client for Langoost — connect and run insertOne, insertMany, find, findOne, updateOne, deleteOne, and count over an integer handle.
Read →form
Parse HTML form submissions in Langoost — URL-encoded and multipart bodies, returning fields and uploaded files.
Read →http2
Serve HTTP/2 in Langoost — TLS h2 with http2.serve and cleartext h2c with http2.serveCleartext, using the same handler shape as the http_server library.
Read →proto
Encode and decode Protocol Buffers wire format in Langoost using tag-to-type maps — varint, fixed, length-delimited, zigzag, and repeated fields.
Read →image
Pure-Go image processing in Langoost — load, decode, resize, fit, thumbnail, crop, rotate, flip, blur, sharpen, grayscale, and invert, for PNG, JPEG, GIF, TIFF, and BMP.
Read →ffmpeg
Transcode and inspect media in Langoost by wrapping the system ffmpeg and ffprobe — transcode, extract audio and frames, thumbnails, and probe metadata.
Read →stun
STUN client and server in Langoost — discover your NAT-mapped public address, or run a minimal STUN BIND responder.
Read →turn
Run a TURN relay server in Langoost with long-term credential authentication, for relaying media when peers can't connect directly.
Read →webrtc
WebRTC peer connections in Langoost — SDP offer/answer, data channels, and connection-state callbacks, with ICE, STUN, and DTLS-SRTP handled internally.
Read →raft
Run a Raft consensus node in Langoost — bootstrap a cluster, replicate a log through an applyLog callback, and query leadership and state.
Read →tun
Create and use a TUN network interface in Langoost — open, read, and write raw IP packets. Requires root privileges.
Read →gpio
GPIO, PWM, I2C, and SPI access in Langoost for single-board computers like the Raspberry Pi — digital pins, hardware PWM, and the I2C and SPI buses.
Read →encoding
Flat base64, base64url, base32, and hex encode/decode helpers in Langoost — a convenience module alongside the submodule-based encode module.
Read →thread
Concurrency primitives in Langoost — goroutines, worker pools, async futures, channels, mutexes, RW locks, semaphores, atomics, and a scheduler.
Read →Reference
Debugging
Debug Langoost programs with the terminal (TUI) debugger or the built-in Debug Adapter Protocol (DAP) server — breakpoints, stepping, locals and globals, in VS Code, Neovim, and any DAP editor.
Read →Testing
Write and run tests in Langoost — test_ functions in _test.goost files, the assert module (eq, ne, ok, throws), and the langoost test runner.
Read →CLI reference
The langoost command-line interface — run, build projects, compile and cross-compile binaries, the REPL, the execution server, tests, benchmarks, dependency install and verify, and debuggers.
Read →Architecture
How Langoost works under the hood — the lexer/parser/compiler/VM pipeline, the 4-byte bytecode format, the stack model, the module cache, and per-request VM isolation.
Read →