# YOUNA Programming Language > YOUNA is a general-purpose language by Younasoft. Source files end in `.you`. > It compiles to JavaScript and ships to web, desktop, Android, iOS and > standalone executables from a single codebase. Requires Node.js >= 22.6. > License: MIT. Copyright Younasoft / Younasons Ltd. This file is a machine-readable quick reference for AI assistants and code generators. All syntax below is verified against the real compiler. ## Core syntax - Comments: `// line comment` - Variables: `let name = value` (no `const`; strings interpolate: `"{expr}"`) - Functions: ``` function add(a, b) { return a + b } ``` Functions are first-class values: `let op = add; op(1, 2)`. No arrow/lambda syntax — pass named functions. - Conditionals: `if cond { }` — braces required, parens optional/omitted. - Loops: `for i in range(1, 4)`, `for item in array`, `for i in range(len(a))`, `while cond { }`, `break`, `continue`. - Arrays: `[1, 2, 3]` — Maps: `{key: "v"}` — access `m["k"]`, iterate `for k in m`. - Option/safety: `env("PORT") ?? 8080`, `m["k"]!` asserts presence, `unwrap_or`. - Errors: `try { } catch e { } finally { }`, `throw anyValue` (maps allowed). - Concurrency: `spawn(fn, args...)`, `await_task(t)`, `await_all([tasks])`, `parallel for x in xs { }`, `sleep(ms)`, `now()`. - Permissions: top-level `permission network` declarations. Declaring ANY permission switches the program to deny-by-default. `--deny cap` narrows further at the CLI. `supports("network")` checks at runtime. - Modules: `import {name, VERSION} from "./lib.you"`, `import * as lib from "./lib.you"`; names must be `export`ed. Modules execute once, in their own scope. ## Builtin domains (all real, zero dependencies) - HTTP server/client: `http_serve(handlerFn, port, host)`, `http_get(url)`, `http_port(server)`, `http_close(server)` — needs `permission network`. - SQLite: `db_open(":memory:"|path)`, `db_exec`, `db_run(db, sql, [params])`, `db_query(db, sql, [params])` → rows as maps, `db_close`. Params are `?` binds. - MySQL: `mysql_open/mysql_query/...` — real wire protocol. - Blockchain: `chain_create(genesisMap, difficulty)`, `chain_add(chain, txMap)`, `chain_len`, `chain_block(chain, i)`, `chain_verify`, ed25519 signing — real proof-of-work, tamper-evident. - Tensors/AI: `tensor_from`, `tensor_matmul`, `tensor_relu`, `tensor_softmax`, `tensor_add/mul` (broadcasting), `tensor_reshape/transpose`, reductions (`tensor_sum/mean/max`), `tensor_toarray`, `tensor_shape/rank/size`. - Images/2D rasterizer: `image_create(w,h)`, `fill_all`, `fill_rect`, `fill_circle`, `draw_circle`, `fill_polygon`, `draw_polygon`, `draw_line`, `image_set/image_get`, `image_save(img, "out.bmp")`, `image_width/height`. - Crypto: `sha256`, `uuid`, `random_int(n)`, `random_float()` — pure, no permission needed. - Utility: `print`, `len`, `type`, `range`, `split`, `join`, `reverse`, `now`. - Filesystem/network/exec builtins exist but require declared permissions and are denied on the `web` target. ## Toolchain ``` node cli/youna.ts run file.you # interpret node cli/youna.ts check file.you # type-check only node cli/youna.ts tokens file.you # lexer dump node cli/youna.ts init myapp # scaffold node cli/youna.ts build file.you # emit standalone JS node cli/youna.ts build --target android app.you # Gradle → APK node cli/youna.ts build --target ios app.you # Xcode → .app node cli/youna.ts package app.you # single-file .exe node cli/youna.ts run --deny network app.you # sandbox node cli/youna.ts security file.you # capability audit ``` ## Things that DO NOT exist (common AI mistakes) - No arrow functions / lambdas: `n -> n * 2` and `n => n * 2` are SYNTAX ERRORS. Use named functions passed as values. - No `const`, no `var` — only `let`. - No classes/OOP — use functions + maps. - No semicolons needed; statement-per-line. - Interpolation inside a string cannot contain `"` — assign to a `let` first. - `import` paths must end in `.you`. ## Engines & guarantees Three engines — AST interpreter, IR evaluator, JS codegen — must produce identical results (enforced parity). The interpreter's semantics are authoritative. Errors carry source positions. ## Resources - Language overview: https://younasoft.com/youna.html - Guided examples: https://younasoft.com/learn.html - In-browser playground (real compiler): https://younasoft.com/playground.html - Ecosystem: https://younasoft.com/