A structured, modular language engineered for lexical scoping, first-class namespaces, nested collections, and seamless preprocessor compilation.
# Puffin: Lexical blocks, namespaces, macro directives & collections
:>def SERVICE_ID "puffin-core"
:>require_env RUNTIME_ENV
:>coprocess METRICS "system-collector --json"
namespace Telemetry {
:>export record_event
function record_event(event_name) {
static call_count = 0
let timestamp = systime()
call_count++
# Nested dictionary & list literal constructors
let record = D{
"service": @{SERVICE_ID},
"event": event_name,
"env": ENVIRON["RUNTIME_ENV"],
"stats": D{
"invocations": call_count,
"epoch": timestamp
},
"tags": L["fast", "scoped", "modular"]
}
return record
}
}
BEGIN {
let report = Telemetry.record_event("service_boot")
:>assert ExistsPath(report, "stats", "invocations"), "Missing stats"
print "Puffin Engine Ready -> Invocations:", GetPath(report, "stats", "invocations")
}
True block-level scoping with let, persistent function-lifetime memory with static, and immutable const folding.
Encapsulate code with namespace, explicit symbol exports (:>export), and guard-protected multi-file inclusion (:>inc, :>ninc).
First-class literal syntax for lists (L[...]) and dictionaries (D{...}) with deep path traversal via GetPath and SetPath.
Bidirectional interactive shell coprocesses (:>coprocess), runtime assertions (:>assert), and environment verification (:>require_env).