The language grammar.

Generated from the language definition for language 1.0.

Grammar

Abridged EBNF. Reserved words are quoted; ident, string, int, color, duration, jsonlit and expr are the lexer's and the expression grammar's productions.

file        := decl*
decl        := app | entity | page | rule | script | use | contribute | bridge | seed | data | nav | home | view
app         := "app" ident string "{" (appfield)* "}"          (a bare name is the first-party slug `fastyoke.<name>`; a dotted or backticked name is the slug verbatim, e.g. `app `projects` …`)
appfield    := ("tagline"|"category"|"icon"|"authors"|"industries") value
             | "tier" ("free" | "pro_trial" duration | "paid" ident)
             | "brand" "primary" color ["accent" color] ["mode" ("light"|"dark"|"system")]   (a colour is #rrggbb or a string)
             | "spec" version | "version" int | "recipe" ident
             | "classification" ("pure_declarative"|"engine_backed")
             | "engine" jsonlit | "extra" jsonlit | "bindings" jsonlit            (literal forms: the manifest, unknown keys, orphan bindings)
             | "catalog" "{" catalogfield* "}"
catalogfield := "kind" ("app"|"yoke"|"connector"|"app_extension") | "visibility" ("public"|"private")
             | "pricing" ("free" | "recurring" [ident] | "one_time" [ident]) | "version" string   (a const listing's price ids resolve from the environment, so the constant is optional)
             | "owned" "[" identlist "]" | "launch" string | "cap" jsonlit
             | "requires" "[" slug ("," slug)* "]"   (listings that must be installed first; a slug is a dotted listing id)
entity      := "entity" ident [string ["plural" string]] [kind] [locality] "{" (fielddecl | workflow | invariant)* "}"
             | "entity" ident "rollup" "over" ident agg ident ["by" ident] ["where" expr]
kind        := "ledger"
locality    := "place" ("edge"|"replicated") "conflict" ("lww"|"fsm"|"reject")
fielddecl   := ident ":" (type modifier* | "raw" jsonlit)
type        := "text"|"longtext"|"number"|"money" ident|"boolean"|"date"|"datetime"|"file"|"json"
             | "enum" ident ("," ident)* | "ref" ident ["on" "delete" ("restrict"|"nullify"|"cascade")]
             | "computed" type "=" (expr | "rule" ident | "script" ident)
modifier    := "required"|"pii"|"hidden"|"label" string|"help" string|"validate" expr string
             | "mask" "except" identlist
             | "allow" identlist
workflow    := "workflow" "{" "initial" ident "states" identlist ["terminal" identlist] ["guarantee" identlist] ["idempotency" identlist] ["aliases" "{" (ident string)* "}"] (statedecl | transition | invariant)* "}"
statedecl   := "state" ident ["color" color] ["sla" duration ["{" effect* "}"]]
invariant   := "invariant" expr
transition  := ident ":" identlist "->" ident ["fail" ident] [guard] ["signature"] ["aside"] ["by" identlist] ["idempotency" identlist] ["{" effect* "}"]
guard       := "requires" identlist | "when" expr | "guard" "jsonlogic" jsonlit
effect      := "do" verb args
             | "do" "append" ident jsonlit
             | "do" "update" ident "set" ident "=" expr ("," ident "=" expr)* ["where" expr]
             | "do" "delete" ident "where" expr
             | "do" "transition" ident "." ident ["where" expr]
             | "do" "infer" string ["from" identlist] "schema" "{" fielddecl* "}" "timeout" duration ["into" identlist]
             | "do" ("classify" | "extract" | "summarize") ident ["from" identlist] ["schema" "{" fielddecl* "}"] ["into" identlist] "timeout" duration
             | "do" "raw" jsonlit                                  (an action or a binding verbatim)
page        := "page" ident [string] ("list" [ident] | "detail" ident | "custom" ident string | "spa" "from" string [grant] | "dashboard") "{" block* "}"
block       := element
element     := (sugar | container | leaf | each | use | "block" ident ["#" ident] jsonlit | "json" jsonlit) [gate]
view        := "view" ident "(" param ("," param)* ")" "{" element* "}"     param := ident ":" ident   (an entity, or a declared query — its row shape)
container   := ("card" ["title" expr] | "columns" | "column" | "tabs" | "tab" string) ["#" ident] "{" element* "}"   (column only inside columns, tab only inside tabs)
leaf        := "text" expr ["style" ident] ["format" ident [ident]] | "badge" expr ["colour" "by" ident] | "image" expr ["alt" expr]
             | "link" expr "to" ident useargs
each        := "each" ident "in" setexpr ["layout" ident] ["columns" "[" identlist "]"] ["#" ident] "{" element* "}"
use         := "use" ident useargs ["#" ident]        useargs := "(" [usearg ("," usearg)*] ")"     usearg := value | ident ":" value     value := ident | "this" | string | number | "true" | "false"
setexpr     := ident ["where" expr] ["sort" ident ["asc"|"desc"]] ["limit" int] | ident "(" arg ("," arg)* ")"
gate        := "when" expr
nav         := "nav" "[" identlist "]"      home := "home" ident
contribute  := "contribute" "to" ident ["when" "installed" slug] "{" block* "}"
bridge      := "bridge" ident ("with" | "from") slug "." ident "via" ident "view" ident   (with = outgoing, from = incoming)
rule        := "rule" ident ("predicate" expr | "decision" "(" identlist ")" "{" (expr "->" value)* "else" value "}" | "json" jsonlit)
query       := "query" ident ["(" param ("," param)* ")"] "=" ("select" selectbody | "dal" jsonlit)
param       := ident ":" type
selectbody  := projlist "from" source ["where" expr] ["by" identlist] ["having" expr]
               ["sort" ident ("asc"|"desc") ("," ident ("asc"|"desc"))*] ["limit" int] ["offset" int]
projlist    := "*" | proj ("," proj)*        proj := ident | agg "(" ident ")" | agg "(" "*" ")"
source      := ident | "jobs" | "event_log" | "fsm_schemas"
script      := "script" ident kind [props] [grant] ("from" string | "js" rawstring)
kind        := "guard" | "action" | "compute" | "process" | "component"
props       := "props" "(" prop ("," prop)* ")"
prop        := ident ":" (type | ident) ["required"] ["label" string]
grant       := "using" ("db" dbgrant ("," dbgrant)* | "sdk" sdkgrant ("," sdkgrant)*)
dbgrant     := "read" | "write" | "fsm"
sdkgrant    := "read" | "write" | "fsm" | "files" | "forms"
use         := "use" "extension" slug ["at" "page" ident "path" string | "mount" jsonlit]
             | "use" "package" slug version
seed        := "seed" ["demo"|"starter"] ["requires" slug] ("from" string | "{" row* "}")
row         := ident [ident] jsonlit ["state" ident] | "job" jsonlit
data        := "data" ident "{" ("upsert" ident | "hide" identlist | "filter" string string)* "}"
expr        := <precedence grammar over the operator set, field refs, one-level ref traversal, `this`, `me`,
                 literals, lower/upper/coalesce/length/substr, count/sum/avg/min/max with an optional "where">