{"version":1,"format":"A void file is JSON: {\"v\":1,\"name\":\"app\",\"tgt\":[\"linux\"],\"ins\":[[opcode,arg,...],…]}. Opcodes are integers from the table below. Instructions execute top-to-bottom; FUNC blocks are not executed until called via HTTP_ROUTE or CALL.","ref_syntax":"{\"$r\":N} references instruction N's output (0-indexed).","fn_syntax":"{\"$f\":N} references the function defined at instruction N. Use as a handler argument.","arg_types":{"?":"any of the above","[]":"JSON array","b":"bool","f":"float64 — JSON number (float)","fn":"{\"$f\":N} — ref to FUNC/ASYNC_FN at instruction N","i":"int64 — JSON number (integer)","r":"{\"$r\":N} — ref to instruction N's result","s":"string — JSON string","{}":"JSON object"},"targets":["linux","macos","windows","ios","android","web","pwa","wasm","docker"],"file_shape":"{\"v\":1,\"name\":\"my_app\",\"tgt\":[\"linux\",\"docker\"],\"ins\":[[1,\"my_app\"],[3,\"linux\"],[3,\"docker\"], …]}","opcodes":[{"op":1,"name":"MODULE","params":[{"n":"name","t":"s","d":"module identifier"}],"ret":"module_ref","desc":"Declare module name. Must be first instruction.","ex":[1,"my_app"]},{"op":2,"name":"IMPORT","params":[{"n":"path","t":"s","d":"path to .void file or stdlib module"}],"ret":"import_ref","desc":"Import another void file. Stdlib: std/http std/sql std/auth","ex":[2,"std/http"]},{"op":3,"name":"TARGET","params":[{"n":"platform","t":"s","d":"linux|macos|windows|ios|android|web|pwa|wasm|docker"}],"desc":"Set compilation target. Multiple TARGET calls = multi-target.","ex":[3,"linux"]},{"op":4,"name":"EXPORT","params":[{"n":"ref","t":"r","d":"func or value to expose"}],"desc":"Mark as public export.","ex":null},{"op":16,"name":"FUNC","params":[{"n":"name","t":"s"},{"n":"params","t":"[]","d":"[{n:name,t:type},…]"},{"n":"ret","t":"s","d":"return type"}],"ret":"func_ref","desc":"Begin named function block. Close with END_FUNC.","ex":[16,"add",[{"n":"a","t":"i64"},{"n":"b","t":"i64"}],"i64"]},{"op":17,"name":"END_FUNC","params":null,"desc":"Close FUNC or ASYNC_FN block.","ex":[17]},{"op":18,"name":"CALL","params":[{"n":"func","t":"fn"},{"n":"args","t":"[]"}],"ret":"result_ref","desc":"Call function with arguments.","ex":null},{"op":19,"name":"RET","params":[{"n":"val","t":"r"}],"desc":"Return value from function.","ex":null},{"op":20,"name":"RET_VOID","params":null,"desc":"Return void from function.","ex":null},{"op":21,"name":"ASYNC_FN","params":[{"n":"name","t":"s"},{"n":"params","t":"[]"},{"n":"ret","t":"s"}],"ret":"func_ref","desc":"Async function. Body may contain AWAIT.","ex":null},{"op":22,"name":"AWAIT","params":[{"n":"future","t":"r"}],"ret":"result_ref","desc":"Await a future (inside ASYNC_FN).","ex":null},{"op":23,"name":"SPAWN","params":[{"n":"func","t":"fn"},{"n":"args","t":"[]","opt":true}],"desc":"Spawn goroutine/async task. Fire and forget.","ex":null},{"op":24,"name":"LAMBDA","params":[{"n":"params","t":"[]"},{"n":"body","t":"[]","d":"nested instructions"}],"ret":"func_ref","desc":"Inline anonymous function.","ex":null},{"op":32,"name":"LET","params":[{"n":"name","t":"s"},{"n":"val","t":"r"}],"ret":"ref","desc":"Immutable binding.","ex":null},{"op":33,"name":"MUT","params":[{"n":"name","t":"s"},{"n":"val","t":"r"}],"ret":"ref","desc":"Mutable variable.","ex":null},{"op":34,"name":"SET","params":[{"n":"var","t":"r"},{"n":"val","t":"r"}],"desc":"Assign to mutable var.","ex":null},{"op":35,"name":"CONST","params":[{"n":"val","t":"?","d":"literal value"}],"ret":"ref","desc":"Inline constant.","ex":[35,42]},{"op":36,"name":"PARAM","params":[{"n":"index","t":"i","d":"0-based parameter index"}],"ret":"ref","desc":"Get function parameter.","ex":null},{"op":48,"name":"ADD","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"ref","desc":"Add.","ex":null},{"op":49,"name":"SUB","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"ref","desc":"Subtract.","ex":null},{"op":50,"name":"MUL","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"ref","desc":"Multiply.","ex":null},{"op":51,"name":"DIV","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"ref","desc":"Divide.","ex":null},{"op":52,"name":"MOD","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"ref","desc":"Modulo.","ex":null},{"op":53,"name":"EQ","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"bool_ref","desc":"Equal.","ex":null},{"op":54,"name":"NE","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"bool_ref","desc":"Not equal.","ex":null},{"op":55,"name":"LT","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"bool_ref","desc":"Less than.","ex":null},{"op":56,"name":"GT","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"bool_ref","desc":"Greater than.","ex":null},{"op":63,"name":"CONCAT","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"str_ref","desc":"Concatenate strings.","ex":null},{"op":59,"name":"AND","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"bool_ref","desc":"Logical AND.","ex":null},{"op":60,"name":"OR","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"bool_ref","desc":"Logical OR.","ex":null},{"op":61,"name":"NOT","params":[{"n":"a","t":"r"}],"ret":"bool_ref","desc":"Logical NOT.","ex":null},{"op":64,"name":"IF","params":[{"n":"cond","t":"r"}],"desc":"Open if-block. Close with END_IF.","ex":null},{"op":65,"name":"ELSE","params":null,"desc":"Else branch inside if-block.","ex":null},{"op":66,"name":"END_IF","params":null,"desc":"Close if-block.","ex":null},{"op":67,"name":"FOR","params":[{"n":"start","t":"r"},{"n":"end","t":"r"},{"n":"var","t":"s","d":"loop variable name"}],"ret":"iter_ref","desc":"Numeric range loop [start, end). Close with END_FOR.","ex":null},{"op":68,"name":"FOR_EACH","params":[{"n":"collection","t":"r"},{"n":"var","t":"s"}],"ret":"item_ref","desc":"Iterate over list or map. Close with END_FOR.","ex":null},{"op":69,"name":"END_FOR","params":null,"desc":"Close FOR or FOR_EACH.","ex":null},{"op":72,"name":"MATCH","params":[{"n":"val","t":"r"}],"desc":"Pattern match. Use CASE/DEFAULT/END_MATCH.","ex":null},{"op":73,"name":"CASE","params":[{"n":"pattern","t":"?","d":"literal to match"}],"desc":"Match arm.","ex":null},{"op":74,"name":"DEFAULT","params":null,"desc":"Default/wildcard arm.","ex":null},{"op":75,"name":"END_MATCH","params":null,"desc":"Close MATCH block.","ex":null},{"op":80,"name":"HTTP_LISTEN","params":[{"n":"addr","t":"s","d":"e.g. 0.0.0.0"},{"n":"port","t":"i"}],"ret":"server_ref","desc":"Start HTTP server (non-blocking). Returns ref used to set up middleware.","ex":[80,"0.0.0.0",8080]},{"op":81,"name":"HTTP_ROUTE","params":[{"n":"method","t":"s","d":"GET|POST|PUT|DELETE|PATCH"},{"n":"path","t":"s","d":"e.g. /users/:id"},{"n":"handler","t":"fn","d":"FUNC or ASYNC_FN ref"}],"ret":"route_ref","desc":"Register route.","ex":[81,"GET","/users/:id",{"$f":5}]},{"op":82,"name":"HTTP_RESP","params":[{"n":"status","t":"i","d":"HTTP status code"},{"n":"body","t":"r"},{"n":"content_type","t":"s","d":"application/json|text/plain|text/html"}],"desc":"Send response. Use inside route handler.","ex":null},{"op":83,"name":"HTTP_BODY","params":null,"ret":"map_ref","desc":"Get parsed JSON request body as map.","ex":null},{"op":84,"name":"HTTP_PARAM","params":[{"n":"name","t":"s","d":"path param name (from :name in route)"}],"ret":"str_ref","desc":"Get URL path parameter.","ex":null},{"op":85,"name":"HTTP_QUERY","params":[{"n":"name","t":"s"}],"ret":"str_ref","desc":"Get URL query parameter.","ex":null},{"op":86,"name":"HTTP_HEADER","params":[{"n":"name","t":"s"}],"ret":"str_ref","desc":"Get request header.","ex":null},{"op":89,"name":"HTTP_MIDDLEWARE","params":[{"n":"handler","t":"fn"}],"desc":"Register global middleware (runs before every route).","ex":null},{"op":90,"name":"HTTP_STATIC","params":[{"n":"route","t":"s"},{"n":"dir","t":"s","d":"filesystem directory"}],"desc":"Serve static files.","ex":null},{"op":96,"name":"SQL_CONNECT","params":[{"n":"dsn","t":"s","d":"connection string"},{"n":"driver","t":"s","d":"postgres|mysql|sqlite"}],"ret":"db_ref","desc":"Create connection pool. Retries on startup.","ex":[96,"postgres://user:pass@db:5432/mydb","postgres"]},{"op":97,"name":"SQL_QUERY","params":[{"n":"db","t":"r"},{"n":"query","t":"s","d":"SQL with $1 $2 placeholders"},{"n":"params","t":"[]","opt":true}],"ret":"rows_ref","desc":"Execute SELECT → list of maps.","ex":null},{"op":98,"name":"SQL_EXEC","params":[{"n":"db","t":"r"},{"n":"query","t":"s"},{"n":"params","t":"[]","opt":true}],"ret":"result_ref","desc":"Execute INSERT/UPDATE/DELETE.","ex":null},{"op":99,"name":"SQL_MIGRATE","params":[{"n":"db","t":"r"},{"n":"sql","t":"s","d":"DDL SQL"}],"desc":"Run migration on startup (idempotent).","ex":[99,{"$r":2},"CREATE TABLE IF NOT EXISTS users (id SERIAL PRIMARY KEY, name TEXT NOT NULL, email TEXT UNIQUE NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW())"]},{"op":103,"name":"SQL_ROW_ONE","params":[{"n":"rows","t":"r"}],"ret":"map_ref","desc":"Get first row from query result, or null.","ex":null},{"op":128,"name":"JWT_SIGN","params":[{"n":"payload","t":"{}M"},{"n":"secret","t":"r"},{"n":"expires_secs","t":"i"}],"ret":"token_str_ref","desc":"Sign JWT.","ex":null},{"op":129,"name":"JWT_VERIFY","params":[{"n":"token","t":"r"},{"n":"secret","t":"r"}],"ret":"claims_map_ref","desc":"Verify JWT. Returns null if invalid.","ex":null},{"op":130,"name":"BCRYPT","params":[{"n":"password","t":"r"}],"ret":"hash_str_ref","desc":"Bcrypt hash.","ex":null},{"op":131,"name":"BCRYPT_CHK","params":[{"n":"password","t":"r"},{"n":"hash","t":"r"}],"ret":"bool_ref","desc":"Verify bcrypt hash.","ex":null},{"op":132,"name":"AUTH_MW","params":[{"n":"secret","t":"r"}],"desc":"JWT auth middleware. Injects user into request context.","ex":null},{"op":133,"name":"CTX_USER","params":null,"ret":"map_ref","desc":"Get authenticated user from context (only inside auth-protected handler).","ex":null},{"op":176,"name":"DOCKER_SVC","params":[{"n":"name","t":"s"},{"n":"image","t":"s","d":"Docker image"}],"ret":"svc_ref","desc":"Add a Docker service.","ex":[176,"postgres","postgres:16-alpine"]},{"op":177,"name":"DOCKER_BUILD","params":[{"n":"svc","t":"r"},{"n":"context","t":"s","d":"build context path"},{"n":"dockerfile","t":"s"}],"desc":"Build service from Dockerfile.","ex":null},{"op":178,"name":"DOCKER_PORT","params":[{"n":"svc","t":"r"},{"n":"host","t":"i"},{"n":"container","t":"i"}],"desc":"Expose port.","ex":null},{"op":179,"name":"DOCKER_ENV","params":[{"n":"svc","t":"r"},{"n":"vars","t":"{}M","d":"env var map"}],"desc":"Set environment variables.","ex":null},{"op":180,"name":"DOCKER_VOL","params":[{"n":"svc","t":"r"},{"n":"host","t":"s"},{"n":"container","t":"s"}],"desc":"Mount volume.","ex":null},{"op":181,"name":"DOCKER_DEPS","params":[{"n":"svc","t":"r"},{"n":"deps","t":"[]","d":"[svc_ref…]"}],"desc":"Set service dependencies.","ex":null},{"op":182,"name":"DOCKER_HEALTH","params":[{"n":"svc","t":"r"},{"n":"test","t":"s","d":"healthcheck command"},{"n":"interval","t":"s","d":"e.g. 10s"},{"n":"retries","t":"i"}],"desc":"Configure healthcheck.","ex":null},{"op":183,"name":"DOCKER_RESTART","params":[{"n":"svc","t":"r"},{"n":"policy","t":"s","d":"always|unless-stopped|on-failure"}],"desc":"Set restart policy.","ex":null},{"op":224,"name":"TYPE_DEF","params":[{"n":"name","t":"s"},{"n":"fields","t":"[]","d":"[{n:name,t:type,tag?:jsonTag}…]"}],"ret":"type_ref","desc":"Define struct type.","ex":[224,"User",[{"n":"id","t":"int64","tag":"json:\"id\""},{"n":"name","t":"string","tag":"json:\"name\""},{"n":"email","t":"string","tag":"json:\"email\""}]]},{"op":226,"name":"NEW","params":[{"n":"type","t":"r"},{"n":"fields","t":"{}M","d":"field:val pairs"}],"ret":"ref","desc":"Create struct instance.","ex":null},{"op":227,"name":"FIELD","params":[{"n":"obj","t":"r"},{"n":"name","t":"s","d":"field name"}],"ret":"ref","desc":"Get struct field.","ex":null},{"op":230,"name":"JSON_ENC","params":[{"n":"val","t":"r"}],"ret":"str_ref","desc":"JSON encode.","ex":null},{"op":231,"name":"JSON_DEC","params":[{"n":"str","t":"r"},{"n":"type","t":"s","d":"type name or map"}],"ret":"map_ref","desc":"JSON decode.","ex":null},{"op":233,"name":"VALIDATE","params":[{"n":"val","t":"r"},{"n":"rules","t":"{}M","d":"{field: 'required|min:3|max:100|email'}"}],"ret":"map_ref","desc":"Validate. Returns {ok:bool, errors:{field:[msg…]}}","ex":null},{"op":240,"name":"LOG","params":[{"n":"level","t":"s","d":"debug|info|warn|error"},{"n":"msg","t":"r"},{"n":"fields","t":"{}M","opt":true,"d":"extra structured fields"}],"desc":"Structured log output.","ex":null},{"op":242,"name":"PRINTLN","params":[{"n":"val","t":"r"}],"desc":"Print line to stdout.","ex":null},{"op":246,"name":"ENV","params":[{"n":"name","t":"s","d":"env var name"},{"n":"default","t":"s","opt":true,"d":"default if missing"}],"ret":"str_ref","desc":"Read environment variable.","ex":null},{"op":247,"name":"OS_EXIT","params":[{"n":"code","t":"i","d":"exit code"}],"desc":"Exit process.","ex":null},{"op":248,"name":"TRY","params":null,"desc":"Begin try block.","ex":null},{"op":249,"name":"CATCH","params":[{"n":"var","t":"s","d":"error variable name"}],"desc":"Catch block.","ex":null},{"op":250,"name":"END_TRY","params":null,"desc":"End try/catch.","ex":null},{"op":251,"name":"THROW","params":[{"n":"msg","t":"r"},{"n":"code","t":"i","opt":true,"d":"error code"}],"desc":"Throw error.","ex":null},{"op":253,"name":"UNWRAP","params":[{"n":"result","t":"r"}],"ret":"ref","desc":"Unwrap nullable — panic if null.","ex":null},{"op":254,"name":"OR_ELSE","params":[{"n":"val","t":"r"},{"n":"default","t":"r"}],"ret":"ref","desc":"Null coalescing. Return default if val is null.","ex":null},{"op":192,"name":"LIST_NEW","params":[{"n":"items","t":"[]","opt":true}],"ret":"list_ref","desc":"Create list.","ex":null},{"op":193,"name":"LIST_PUSH","params":[{"n":"list","t":"r"},{"n":"item","t":"r"}],"desc":"Append item.","ex":null},{"op":197,"name":"LIST_LEN","params":[{"n":"list","t":"r"}],"ret":"i_ref","desc":"List length.","ex":null},{"op":195,"name":"LIST_GET","params":[{"n":"list","t":"r"},{"n":"index","t":"r"}],"ret":"ref","desc":"Get by index.","ex":null},{"op":198,"name":"LIST_MAP","params":[{"n":"list","t":"r"},{"n":"fn","t":"fn"}],"ret":"list_ref","desc":"Map over list.","ex":null},{"op":199,"name":"LIST_FILTER","params":[{"n":"list","t":"r"},{"n":"fn","t":"fn"}],"ret":"list_ref","desc":"Filter list.","ex":null},{"op":201,"name":"MAP_NEW","params":[{"n":"entries","t":"{}M","opt":true}],"ret":"map_ref","desc":"Create map.","ex":null},{"op":202,"name":"MAP_GET","params":[{"n":"map","t":"r"},{"n":"key","t":"r"}],"ret":"ref","desc":"Get map value.","ex":null},{"op":203,"name":"MAP_SET","params":[{"n":"map","t":"r"},{"n":"key","t":"s"},{"n":"val","t":"r"}],"desc":"Set map value.","ex":null},{"op":207,"name":"MAP_MERGE","params":[{"n":"a","t":"r"},{"n":"b","t":"r"}],"ret":"map_ref","desc":"Merge two maps (b overwrites a).","ex":null},{"op":217,"name":"STR_FORMAT","params":[{"n":"fmt","t":"s","d":"format string with %s %d %f"},{"n":"args","t":"[]"}],"ret":"str_ref","desc":"Format string.","ex":null},{"op":210,"name":"STR_SPLIT","params":[{"n":"s","t":"r"},{"n":"delim","t":"s"}],"ret":"list_ref","desc":"Split string.","ex":null},{"op":215,"name":"STR_CONTAINS","params":[{"n":"s","t":"r"},{"n":"sub","t":"s"}],"ret":"bool_ref","desc":"Contains check.","ex":null},{"op":223,"name":"RAND_STR","params":[{"n":"length","t":"i"},{"n":"charset","t":"s","d":"hex|alpha|alnum|uuid"}],"ret":"str_ref","desc":"Generate random string. charset=uuid ignores length.","ex":null}],"notes":["Instructions execute top-to-bottom; FUNC blocks are deferred until called.","HTTP_LISTEN starts the server in a goroutine; codegen blocks main() automatically.","SQL_CONNECT retries on startup; pass DSN via ENV for 12-factor compliance.","DOCKER_* opcodes are metadata: they only affect docker-compose.yml, not the binary.","For web/pwa targets, use WEB_* opcodes. For native, use UI_* opcodes.","Any HTTP/SQL/Redis app gets a docker-compose.yml + Dockerfile generated automatically."]}
