Skip to content

Commit c8b9d16

Browse files
author
morphqdd
committed
merge: #108 lash Phase 1 — schema builder API + smoke test
Phase 1 ships: - parser(n) — fresh 4 KB schema buf. - flag(p long short) / opt(p long short) / positional(p name) — inline-able schema mutators (single-Ret bodies fold via #78 2a). - get_flag / get_opt / get_positional — read accessors on a populated schema. - parse(p) — argv driver. Compiles, but actually running it on a non-empty argv hits bug #130 (4+ buf-typed ret-machine wait chain deadlock); blocked on #130 to flip the smoke from 'schema only' to 'argv-driven'. Smoke fixture under examples/lash_smoke/ exercises the schema builders + get_flag against an empty schema.
2 parents 115859c + eda9f59 commit c8b9d16

3 files changed

Lines changed: 725 additions & 0 deletions

File tree

examples/lash_smoke/main.lake

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// lash smoke fixture — Phase 1 schema builder.
2+
//
3+
// Phase 1 ships schema construction (`parser`, `flag`, `opt`,
4+
// `positional`) + getters on an unparsed schema. The argv-driving
5+
// `parse` runtime path hits a compiler chain-depth limit (see
6+
// docs/state/bugs/128_buf_ret_chain_3deep.md) and is exercised in
7+
// Phase 2 once the underlying ret-machine wait dequeue is fixed.
8+
//
9+
// Build / run:
10+
// LAKE_PATH=$(pwd) lakec examples/lash_smoke/main.lake
11+
// ./examples/lash_smoke/build/main
12+
13+
+std.experimental.lash.{ parser flag opt positional get_flag }
14+
+std.io.{ println }
15+
@rt(rt_exit)
16+
17+
main is {
18+
_ -> {
19+
let p = parser(0)
20+
let p = flag(p "verbose" "v")
21+
let p = opt(p "name" "n")
22+
let p = positional(p "input")
23+
let v = get_flag(p "verbose")
24+
pin println("schema built")
25+
rt_exit(0)
26+
}
27+
}

0 commit comments

Comments
 (0)