Add object primitives, official ext/llm, and HTTPS/dotenv platform.

Introduce # objects with ## methods (handles + ` x.method `), ship OpenAI-compatible ext/llm, and upgrade net/sys for HTTPS headers and dotenv loading.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-06 11:53:14 +08:00
1 parent b974f10c6e
commit b00b018056
55 files changed
+1741 -291

No files matched your search

+5 -2
View File
@@ -28,12 +28,14 @@ Canonical design (repo): `doc/design/markdown-mapping.md`, `doc/design/keywords.
| Marker | Meaning |
|--------|---------|
| `#` … `######` | Function; heading depth = nesting/scope |
| `- name` under a function heading | Parameter |
| `#` | **Object / type** (constructor body). `# main` = entry object. |
| `##` … `######` | **Function / method** (nesting by heading depth). |
| `- name` under a heading | Parameter |
| `- …` inside body | Loop |
| `+ …` or `1.` | Branch arm (condition) |
| Line that is only `*` | Else arm |
| `> fn args` | Call (named `k=v` or positional) |
| `` > `obj`.method args `` | Method call (`obj` must be a map with `_type`) |
| Frontmatter `> path.mq.md` | Import |
| `*…*` | Statement (bind / expr) |
| `**…**` | Return value |
@@ -119,6 +121,7 @@ title: example
- Import **English** or **Chinese** library file; call that file’s API names (do not mix).
- `lib/…` resolves via `MARQDO_LIB`, cwd `lib/`, or `lib/` next to the `marqdo` binary.
- Official optional extensions: `ext/llm.mq.md` / `ext/大模型.mq.md` — `# llm` / `# 大模型` object handles + `## complete` / `## 运行`. Free `## load_env`. See `doc/design/ext-llm.md` and `doc/design/objects.md`.
- Builtins (no import): `print`/`打印`, `input`/`输入`, `len`/`长度`, `str`/`文本`, `int`/`整数`; literals `True`/`真`, `False`/`假`, `None`/`空`; logic `and`/`且`, `or`/`或`, `not`/`非`.
Stdlib map: [reference.md](reference.md).
+6 -3
View File
@@ -17,6 +17,8 @@ Diagnostics look like `path:line:col: message` (1-based line/col).
Stdlib search order for `lib/…` imports: `MARQDO_LIB`, `./lib`, directory of the `marqdo` executable (and a few parents). Prefer the **bundle zip** (`marqdo.exe` + `lib/`) over a bare exe.
官方扩展(`ext/…`,非 stdlib):`MARQDO_EXT`、`./ext`、或可执行文件旁 `ext/`。对象原语见 `doc/design/objects.md`。LLM:`ext/llm.mq.md` / `ext/大模型.mq.md`(`# llm` 句柄 + `` `x`.complete `` / `` `x`.运行 ``;项目本地 `.env` 配密钥)。
## Builtins (no import)
| EN | ZH | Role |
@@ -38,12 +40,13 @@ Import one file; use **that** file’s function names.
| `lib/text.mq.md` | `lib/文本.mq.md` | text helpers / 去空白·拆分·拼接… |
| `lib/table.mq.md` | `lib/表.mq.md` | table/rows helpers |
| `lib/fs.mq.md` | `lib/文件.mq.md` | filesystem |
| `lib/sys.mq.md` | `lib/系统.mq.md` | process / cwd |
| `lib/sys.mq.md` | `lib/系统.mq.md` | process / cwd / load_dotenv |
| `lib/time.mq.md` | `lib/时间.mq.md` | time/format |
| `lib/net.mq.md` | `lib/网络.mq.md` | network helpers |
| `lib/json.mq.md` | (see design) | JSON |
| `lib/net.mq.md` | `lib/网络.mq.md` | HTTP(S) helpers (+ optional headers) |
| `lib/json.mq.md` | (see design) | JSON (+ `quote`) |
| `lib/math.mq.md` | `lib/数学.mq.md` | num, trig, random, formula, plot |
| `lib/foreign.mq.md` | `lib/外联.mq.md` | run foreign fenced blocks |
| `ext/llm.mq.md` | `ext/大模型.mq.md` | `# llm` / `# 大模型` object + chat methods |
Open the imported `.mq.md` under `lib/` to see exact `#` function names and parameters. Gold tests: `tests/lib/`, `tests/structure/`.