灵符lingfu

ling-lang

↓ 0 downloads

Ling - The Omniglot Systems Language

Keywords systems, polyglot, ai, crypto, game
lingfu install ling-lang
LicenseApache-2.0 OR MIT
AuthorsLing Lin, Sanny Lin
READMECode / FilesVersionsDependency GraphDependentsSecurityBuildsSettings

Code / Files (995)

Cargo.toml
[package]
name = "ling-lang"
version = "2030.1.53"
edition = "2021"
description = "Ling - The Omniglot Systems Language"
authors = [
    "Ling Lin <taellinglin@gmail.com>",
    "Sanny Lin <SannyLing53@gmail.com>"
]
license = "Apache-2.0 OR MIT"
repository = "https://github.com/taellinglin/ling"
homepage = "https://ling-lang.org"
documentation = "https://docs.ling-lang.org"
readme = "README.md"
# Make `cargo run` build Ling itself (not lingfu) by default.
# Run Lingfu with: cargo run -p lingfu --bin lingfu
default-run = "ling"
keywords = ["systems", "polyglot", "ai", "crypto", "game"]
categories = ["compilers", "graphics", "game-development", "artificial-intelligence", "cryptography"]
rust-version = "1.85"
# Keep the published crate small (crates.io 10 MB limit): ship only source.
# These dirs aren't needed to compile the library/binaries (verified: nothing
# embeds them via include_str!/include_bytes!).
exclude = [
    "assets/", "examples/", "docs/", "instruments/", "lexicons/",
    "chinese-room-web/", "dist/", "recordings/", "cache/", "*.svg",
]

[workspace]
members = [
    "crates/ling-core",
    "crates/ling-lex",
    "crates/ling-polyglot",
    "crates/ling-ai",
    "crates/ling-llm",
    "crates/ling-icon",
    "crates/ling-crypto",
    "crates/ling-audio",
    "crates/ling-net",
    "crates/ling-http",
    "crates/ling-mir",
    "crates/ling-fu",
    "crates/ling-graphics",
    "crates/ling-wasm",
    "crates/ling-ast",
    "crates/ling-codegen",
    "crates/ling-runtime",
    "crates/ling-ui",
    "crates/ling-game",
    "crates/ling-macro",
    "crates/ling-mic",
    "crates/ling-physics",
    "crates/ling-py",
    "crates/ling-music",
    "crates/ling-body",
    "crates/ling-daw",
    "crates/ling-osdaw",
    "crates/ling-gpu",
    "crates/ling-animation",
    "crates/ling-input",
    "crates/ling-kernel",
    "crates/ling-user",
    "crates/ling-web"

]
exclude = [
    # Build artifacts
    "examples/.ling-build",
    "examples/.ling-build/**",
    "examples/music/.ling-build/hallway_runner",
    "examples/music/.ling-build/karaoke_hero",
    ".ling-shared-target",
    ".ling-shared-target/**",
    # Pre-built binaries
    "dist",
    "dist/**",
    "examples/sakohn",
    "examples/sakohn/**",
    "examples/crypto",
    "examples/crypto/**",
    "examples/physics",
    "examples/physics/**",
    # Generated / large output files
    "examples/*_map.svg",
    "examples/tools/ling_map.ling",
    # Editor / tooling
    ".claude",
    ".claude/**",
    ".vscode",
    ".idea",
    # Web demo (separate repo concern)
    "chinese-room-web",
    "chinese-room-web/**",
    # Docs build output (large fonts/woff2, rebuilt by CI)
    "docs/book",
    "docs/book/**",

]

[lib]
name = "ling"
path = "src/lib.rs"

[[bin]]
name = "ling"
path = "src/main.rs"

[[bin]]
name = "lingc"
path = "src/bin/lingc.rs"

[[bin]]
name = "lx"
path = "src/bin/lx.rs"

[[bin]]
name = "ling-repl"
path = "src/bin/ling-repl.rs"

[features]
# Enable LLVM-backed native codegen (requires LLVM toolchain)
llvm = []
# Native GPU rasteriser (wgpu offscreen). Opt-in foundation for GPU drawing;
# the default build is unaffected. Verified by gfx::wgpu_raster tests.
gpu = ["dep:wgpu", "dep:pollster"]
# Enable the CUDA compute backend (ling-gpu): GPU-accelerated N-body and batch
# vertex projection across every NVIDIA device (multi-GPU). Runtime-detected —
# falls back to the parallel CPU backend when no CUDA device is present.
cuda = ["ling-gpu/cuda", "ling-physics/cuda", "ling-ai/cuda"]
# Image understanding (vision_load/vision_analyze_start/poll) for
# chat.ling-lang.org's attach-an-image flow — Moondream2, CUDA-capable.
# Separate from `llm` so a build can have chat without vision or vice versa.
vision = ["ling-ai/vision"]
# In-process chat-completion builtins (llm_load/llm_generate_start/poll):
# candle-transformers loads a GGUF checkpoint and runs generation on a
# background thread so it never blocks http_serve's single-threaded dispatch
# loop (same reasoning as `web`'s http_post_async, above) — this process IS
# the model server, nothing is shelled out to. Off by default: pulls in
# candle-core/candle-nn/candle-transformers/tokenizers, a heavy addition
# irrelevant to builds that don't need local LLM inference. Pair with `cuda`
# for GPU acceleration.
llm = ["ling-ai/llm", "ling-daw/llm"]
# See ling-ai's Cargo.toml for why this is separate from `cuda` above.
llm-cuda = ["ling-ai/llm-cuda", "ling-daw/llm"]
# HTTP server builtins (http_route/http_serve): axum/rustls/rusqlite via
# ling-http. Off by default — the compiler/game/graphics build shouldn't
# carry a web server stack unless a program actually uses it.
# tower-http's ServeDir backs http_static (binary-safe static files); reqwest
# backs http_post_async/http_job_poll (non-blocking outbound calls, e.g. to
# a local Stable Diffusion API, so one slow request doesn't stall http_serve's
# single-threaded dispatch loop for every other visitor); zip backs zip_files.
# (Not ling-web: it declares its own `[workspace]`, so the root crate can't
# path-depend on it — "multiple workspace roots" — reuse just the one type it
# would have given us, tower_http::services::ServeDir, directly instead.)
web = ["dep:ling-http", "dep:tower-http", "dep:reqwest", "dep:zip", "dep:hmac", "dep:sha1", "dep:tar"]

[dependencies]
glam = "0.33"
base64 = "0.22"
flate2 = "1"
rand = "0.8"   # random_hex builtin (session ids / nonces) — a real ling-crypto dep already, pinned here too for direct use in runtime/mod.rs
sha2 = "0.10"   # sha256_hex builtin — ling-crypto has Blake3/SHA-3/SHAKE but not plain SHA-256, which is what browsers' native SubtleCrypto provides for client-side proof-of-work mining; server-side verification needs to match exactly
ling-physics = { workspace = true, features = ["with-gltf"] }
ling-gpu = { path = "crates/ling-gpu", version = "2030.0.10" }
ling-graphics = { path = "crates/ling-graphics", version = "2030.0.13" }
ling-game = { path = "crates/ling-game", version = "2030.1.9" }
ling-animation = { workspace = true }
ling-mir = { workspace = true }
ling-ast = { workspace = true }
rustc-hash = "2.0"   # fast non-crypto hasher for the interpreter env/dispatch maps
ling-core = { workspace = true }
ling-codegen = { workspace = true }
fontdue = "0.9"   # rasterizes a kernel project's idle-timeout font (font/*.otf) to a VGA bitmap at build time

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
serde_json = "1.0"   # stt_* builtins read faster-whisper output
ling-daw = { path = "crates/ling-daw", version = "2030.0.2" }
ling-body = { path = "crates/ling-body", version = "2030.0.2" }
minifb = "0.27"
rayon = { workspace = true }   # parallel software rasteriser (banded flush)
ling-ai = { path = "crates/ling-ai", version = "2030.0.10" }
ling-icon = { path = "crates/ling-icon", version = "2030.0.9" }
ling-audio = { workspace = true }
ling-music = { path = "crates/ling-music", version = "2030.0.9" }
ling-mic = { path = "crates/ling-mic", version = "2030.0.12" }
ling-crypto = { path = "crates/ling-crypto", version = "2030.1.13" }
subtle = "2.6"   # constant-time compare for lingtp_*'s handshake Finished-MAC check
ling-net = { path = "crates/ling-net", version = "2030.0.9", default-features = false, features = ["lwp"] }   # p2p_* builtins: LWP-1 transport (ling-wallet LING_API.md §4)
ling-ui = { path = "crates/ling-ui", version = "2030.0.9" }
gilrs = "0.11"   # native gamepad + rumble (XInput/DInput/evdev)
ling-input = { workspace = true, features = ["gilrs"] }   # gamepad/joystick/VR/touch builtins
image = { version = "0.25", default-features = false, features = ["png"] }   # PNG screenshots
resvg = "0.44"   # tm_tex_load: SVG / SVGZ textures for the game3d textured-mesh builtins
ling-http = { workspace = true, optional = true, features = ["dev-certs"] }   # http_route/http_serve builtins (feature = "web"); dev-certs backs http_serve_dev_tls
tower-http = { version = "0.6", features = ["fs"], optional = true }   # ServeDir backs http_static (feature = "web")
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"], optional = true }   # http_post_async/http_job_poll builtins (feature = "web")
zip = { version = "2", default-features = false, features = ["deflate"], optional = true }   # zip_files builtin (feature = "web")
tar = { version = "0.4", optional = true }   # tar_gz_list/tar_gz_read builtins — browse a package's uploaded tarball (feature = "web")
hmac = { version = "0.12", optional = true }   # TOTP (2FA) builtins (feature = "web")
sha1 = { version = "0.10", optional = true }   # TOTP HMAC-SHA1 (feature = "web")
qrcode = { version = "0.14", default-features = false, features = ["svg"] }   # qr_svg builtin — scannable otpauth:// codes for 2FA setup
bip39 = "2"   # lw_mnemonic_from / lw_mnemonic_to builtins (ling-wallet: 24-word BIP-39 English encoding of the master seed)
# Optional native GPU rasteriser backend (feature = "gpu").
wgpu = { version = "22", optional = true }
pollster = { version = "0.3", optional = true }
russh = { version = "0.63.1", default-features = false, features = ["flate2", "ring", "rsa"] }   # aws-lc-rs (the default crypto backend) needs NASM on Windows; ring doesn't
rand10 = { version = "0.10", package = "rand" }
tokio = { workspace = true }   # async runtime backing ssh_* builtins (russh is tokio-based)

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
js-sys = "0.3"
ling-crypto = { path = "crates/ling-crypto", version = "2030.1.13" }
ling-music = { path = "crates/ling-music", version = "2030.0.9" }
# Pure-geometry vector UI (holo brackets/text + easings) — wasm-safe, so the
# ui_* / ease builtins render on the web via the software framebuffer too.
ling-ui = { path = "crates/ling-ui", version = "2030.0.9" }
web-sys = { version = "0.3", features = [
    # Console
    "console",
    # Worker and ImageBitmap
    "DedicatedWorkerGlobalScope",
    "ImageBitmap",
    # Graphics
    "OffscreenCanvas",
    "WebGl2RenderingContext",
    "WebGlProgram",
    "WebGlShader",
    "WebGlBuffer",
    "WebGlUniformLocation",
    "WebGlTexture",
    # Web Audio API
    "AudioContext",
    "AudioContextOptions",
    "AudioDestinationNode",
    "AudioListener",
    "AudioNode",
    "AudioParam",
    "BaseAudioContext",
    "GainNode",
    "OscillatorNode",
    "OscillatorType",
    "PannerNode",
    "PanningModelType",
    "DistanceModelType",
    "AudioBuffer",
    "AudioBufferSourceNode",
    # Web Gamepad API
    "Navigator",
    "Window",
    "Gamepad",
    "GamepadButton",
    # Touch events
    "EventTarget",
    "TouchEvent",
    "Touch",
    "TouchList",
] }

[build-dependencies]


# Needed by build.rs for generating parser grammar via lalrpop
lalrpop = "0.22"

# Embeds assets/ling.ico into ling.exe / lingc.exe / lx.exe / ling-repl.exe.
winresource = "0.1"



[workspace.dependencies]
# Core
ling-core     = { path = "crates/ling-core", version = "2030.0.9" }
ling-lex      = { path = "crates/ling-lex", version = "2030.0.8" }
ling-ast      = { path = "crates/ling-ast", version = "2030.0.8" }
ling-mir      = { path = "crates/ling-mir", version = "2030.0.12" }
ling-codegen  = { path = "crates/ling-codegen", version = "2030.0.13" }
ling-runtime  = { path = "crates/ling-runtime", version = "2030.0.8" }
ling-polyglot = { path = "crates/ling-polyglot", version = "2030.0.8" }
ling-macro    = { path = "crates/ling-macro", version = "2030.0.8" }

# Graphics & Game
ling-graphics = { path = "crates/ling-graphics", version = "2030.0.13" }
ling-ui       = { path = "crates/ling-ui", version = "2030.0.9" }
ling-game     = { path = "crates/ling-game", version = "2030.1.9" }
ling-animation = { path = "crates/ling-animation", version = "2030.0.8" }
ling-input    = { path = "crates/ling-input", version = "2030.0.9" }

# AI
ling-ai = { path = "crates/ling-ai", version = "2030.0.10" }

# Crypto
ling-crypto   = { path = "crates/ling-crypto", version = "2030.1.13" }
aes-gcm       = "0.10"
curve25519-dalek = "4.1"
blake3        = "1.5"

# Audio
ling-audio = { path = "crates/ling-audio", version = "2030.0.13" }
ling-music = { path = "crates/ling-music", version = "2030.0.9" }
ling-mic   = { path = "crates/ling-mic", version = "2030.0.12" }
cpal       = "0.15"
hound      = "3.5"
half       = "2"

# Networking
ling-net = { path = "crates/ling-net", version = "2030.0.9" }
ling-http = { path = "crates/ling-http", version = "0.1.8" }
tokio    = { version = "1.37", features = ["full"] }
quinn    = "0.11"

# WASM interop (used by reqwest/mistralrs + wgpu)
web-sys = "0.3.74"




js-sys = "0.3.72"
wasm-bindgen = "0.2.95"


# Physics & math
ling-physics = { path = "crates/ling-physics", version = "2030.1.18" }
glam         = "0.33"

# Shared
serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0"
anyhow = "1.0"
rayon = "1.9"
async-trait = "0.1"

[profile.release]
# lto = "fat" + codegen-units = 1 (the previous setting) triggers a real
# release-only miscompilation: Cranelift JIT-compiling a program with a
# handful of many-parameter (14-16 arg) functions segfaults during codegen
# at every MIR optimization level (confirmed via a --O0..--O3 bisection) and
# a genuine debug build (opt-level=1, no LTO) runs it correctly — so this
# isn't a Ling-source bug, it's specific to this crate's release build
# config. A `reldbg` profile (release opt-level=3, lto=false,
# codegen-units=16, debug-assertions/overflow-checks on) does NOT reproduce
# the crash, isolating fat LTO (or codegen-units=1, likely LTO given it
# forces effectively the same single-unit shape) as the trigger — most
# likely UB in an unsafe block (cranelift-jit's raw executable-memory
# handling, or ling-codegen's `std::mem::transmute`d function-pointer calls
# in jit.rs) that only misbehaves once LTO inlines across the crate
# boundary. Root cause not further isolated (would need a Cranelift/LLVM
# bisection); dropping LTO is the safe fix, not a workaround — it removes
# the miscompilation trigger rather than papering over a symptom. Confirmed
# lto = "thin" ALSO reproduces the hang (same as fat) - only lto = false
# avoided it in testing, so this isn't a fat-vs-thin intensity question.
lto = false
codegen-units = 16
opt-level = 3
panic = "abort"

[profile.dev]
opt-level = 1
debug = true

# DIAGNOSTIC (temporary): release-level optimization (the thing that seems to
# trigger the bug) but WITHOUT fat LTO/codegen-units=1, WITH debug-assertions/
# overflow-checks/symbols/unwind — isolates whether LTO specifically is the
# trigger, and turns a raw segfault into a catchable, located panic if it's
# an ordinary Rust bounds/overflow bug exposed by inlining.
[profile.reldbg]
inherits = "release"
lto = false
codegen-units = 16
panic = "unwind"
debug = true
debug-assertions = true
overflow-checks = true

[package.metadata.docs.rs]
# "llvm" feature requires the LLVM toolchain and is not suitable for docs.rs.
# Build with no extra features so the base public API is documented.
rustdoc-args = ["--cfg", "docsrs"]

← Back to index