Skip to content

fx 0.8.0 - IR by default, dual paths, real tools

Choose a tag to compare

@shawnlondono shawnlondono released this 06 Aug 14:59
· 11 commits to main since this release

fx 0.8.0 — IR by default, dual paths, real tools

Language package for ledocorp/fxlang
Tag: v0.8.0
Docs: ledocorp.org/fx · start · surface · composition

0.8.0 is the first package that leads with IR → native as the everyday run path, keeps readable C emission first-class, and ships the writeable-fx dogfood apps as proof that real tools fit the language method.


Why this release matters

Pillar What you get
IR → native by default fx run / fx build lower through IR and link a native binary. That is the normal path.
Emit-C stays first-class fx run --emit-c, fx emit-c, annotate comments, .fxmap + #line, fx locate — audit, embed, or debug via C when you want.
Self-hosted compiler surface Lexer / parse / emit live as inspectable fx under compiler-source/ (read-only; not a rebuild SDK).
Composition under regions Ids, pools, vec_set, Map accumulate, teaching patterns — how to build without mut sugar or an unsafe dialect.
Dogfood tools CHIP‑8, JSON (wrap + pure), line-LCS textdiff — small real programs with clear exit contracts.
Adoption polish Clearer compiler diagnostics on stderr, shared thin C CLI-host recipe, wilder JSON (\uXXXX) on the pure-fx path.

Nothing here removes the C exit ramp. Dual paths are the product.


Highlights (detail)

1. Run path: IR first

fx run main.fx                 # IR → native (default)
fx build main.fx               # same backends; link only
fx run main.fx --emit-c        # emit-C → native
fx emit-c main.fx -o out_c     # inspect .c / .h only

Everyday scaffolds, week-two tools, composition examples, and dogfood apps are meant to stay green on both paths. Prefer the default IR path for day-to-day work; use emit-C when you need readable lowering, host/link recipes, or C-side debugging.

2. Dual-emit tracking

Default emit annotates generated C with /* fx: … */ comments. Debug source mode adds a .fxmap sidecar and #line directives so gcc/clang diagnostics and debuggers can point back at .fx spans. fx locate turns a C file/line into the fx origin.

TRACKING.md

3. Language & std (carried forward, still honest)

Full programming surface from the 0.7.x line, including:

  • Named regions + effects (alloc / mut / io)
  • Result / ?, structs, enums, match, modules, extern "c"
  • Vec / arrays / slices / Buf / Bytes / Map (string→i32 and string→string) / StrBuilder
  • Grow by reassignment (v = vec_push(v, x)); slot writes via vec_set (no v[i] = x on growable Vec)
  • Typed pool Id, map_add_i32, composition examples (composition_tally, composition_reach)

SURFACE.md · COMPOSITION.md · STD.md

4. Dogfood apps (in the package)

App Folder What it is
1 examples/dogfood_chip8/ Headless CHIP‑8 interpreter (composition at scale)
2 examples/dogfood_jsonget/ JSON path CLI via careful cJSON wrap + thin C host
3 examples/dogfood_chip8_ui/ Same machine with a raylib-class visual host
4 examples/dogfood_fxjson/ Same product shape in pure fx (parse/DOM/path); \uXXXX escapes; wild fixtures
5 examples/dogfood_textdiff/ Line-split + LCS edit-script CLI (not Myers / GNU hunks)

Product CLIs that need argv/stdio still use a thin C main; fx owns the logic. Shared host helpers live beside the apps (see WRAP.md).

DOGFOOD.md

5. Adoption quality

  • Compiler diagnostics go to stderr; Result / ? paths get actionable help where it matters
  • Shared CLI host recipe for argv tools (Apps 2 / 4 / 5 style)
  • App 4 JSON deepened for messier real input, including JSON \uXXXX (invalid sequences fail closed)

6. C wrap / bind

fx bind for inspectable Level‑1 stubs; hand-written Level‑2 wrappers where ownership policy matters. Landed wrap examples include JSON path helpers and xxHash. Priority list: LIBRARIES.md.

7. Tooling in the binary

fx doctor · fx new · fx check · fx run / build · fx emit-c · fx cc · fx locate · basic fx lsp · lean fx mcp (check / locate / run).


Install

Requirements: this package · a C toolchain on PATH (gcc default) · Windows or Linux x86_64 prebuilt.

# put package bin/ on PATH
fx doctor
fx version                 # expect v0.8.0

fx new hello
cd hello
fx run main.fx             # exit 42
fx run main.fx --emit-c    # optional second path

Windows without PATH: .\bin\fx.exe … · Linux: ./bin/fx …

Package layout: PACKAGE.md · five-minute path: START_HERE.md


Try (sample commands)

fx run examples/composition_tally/main.fx
fx run examples/composition_reach/main.fx
fx run examples/pattern_pool/main.fx
fx run examples/dogfood_chip8/main.fx
fx run examples/dogfood_fxjson/fxjson_lib.fx --host examples/dogfood_fxjson/host_cli.c
fx emit-c examples/tool_result/main.fx -o out_c --debug-source
fx locate --c-file out_c/main.c --line 42

Exact host/link lines live in each example’s README.


Honesty bounds (0.8.0)

Still out of this package unless listed above:

  • Unsafe dialect / Soft-fx sandbox story
  • Growable-Vec index-assign sugar (v[i] = x)
  • Traits, closures, Option, full generic Map<K,V>
  • Package manager / registry
  • Advanced fx Runtime (devices / capability sandboxes) — design may exist; not shipped
  • macOS prebuilt binary
  • Whole compiler rewritten solely as IR (emit-C remains a first-class product path)

Quality habits for users: QUALITY.md. What’s next (product-facing): NEXT.md.


Upgrade notes (from 0.7.5)

  • Expect fx versionv0.8.0
  • Treat IR → native as the default story in docs and muscle memory; keep --emit-c for audit and host workflows
  • Prefer dual-path confidence on any tool you publish
  • Dogfood folders under examples/dogfood_* are the reference shapes for small CLIs

Thanks

Stewarded by Shawn Londono / LedoCorp · Apache-2.0