@cella-lang/python 0.1.202611082214 → 0.1.202611090955
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +14 -0
- package/README.md +10 -2
- package/index.json +1144 -948
- package/package.json +5 -5
- package/python.builtins.cell +0 -0
- package/python.calls.cell +0 -0
- package/python.cell +0 -0
- package/python.containers.cell +0 -0
- package/python.debugging.cell +0 -0
- package/python.dispatch.cell +0 -0
- package/python.execution.cell +0 -0
- package/python.flattening.cell +0 -0
- package/python.generators.cell +0 -0
- package/python.iterators.cell +0 -0
- package/python.lazy.cell +0 -0
- package/python.lowering.cell +0 -0
- package/python.methods.cell +0 -0
- package/python.numbers.cell +0 -0
- package/python.objects.cell +0 -0
- package/python.operations.cell +0 -0
- package/python.printing.cell +0 -0
- package/python.querying.cell +0 -0
- package/python.random.cell +0 -0
- package/python.session.cell +0 -0
- package/python.sets.cell +0 -0
- package/python.sorting.cell +0 -0
- package/python.symbols.cell +0 -0
- package/python.text.cell +0 -0
- package/python.values.cell +0 -0
- package/python.variables.cell +0 -0
package/CHANGES.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## 未發佈
|
|
4
4
|
|
|
5
|
+
- **新增 `python.observedTypes source input fuel`**(形狀和 semorphe 談定,2026-11-09):跑一次程式(參數同 `python.verdict`),回
|
|
6
|
+
`{"verdict", "nodes", "basis"}`。`nodes` 和 C 家族的 `types().nodes` 同形狀(節點 id 對型別文字),型別照 Python typing 的寫法:
|
|
7
|
+
`int`、`float`、`str`、`bool`、`None`、類別名;`list[int]`、`set[str]`、`dict[str, int]` 取元素(鍵、值)型別的聯集,`tuple[int, str]`
|
|
8
|
+
照位置;空的是 `list[?]`、`set[?]`、`dict[?, ?]`、`tuple[()]`。同一個節點出現過多種型別寫成聯集 `int|str`(不重複,照第一次出現的
|
|
9
|
+
先後)。`basis` 同一組節點對 `observed`,沒跑到的節點是 `unreached`、型別是空字串。收的節點:每個運算式的值、賦值(含解包、`for`、
|
|
10
|
+
`with … as`、`+=`、`:=`)綁上的名字、每個參數;不收被呼叫的運算式自己、型別註記、推導式的目標等(README)。只有 `verdict` 是
|
|
11
|
+
`accept` 才給表;`unknown`、`invalid` 的 `nodes`、`basis` 是空的。**界線:觀察到的型別只對這一組輸入成立。**容器的型別是
|
|
12
|
+
那一刻的值(`xs = []` 的 `xs` 是 `list[?]`,之後的 `append` 不回頭改它;之後讀到的 `xs` 才看得到元素)。 `python.types` 不變。
|
|
13
|
+
- 修正:`print(…, end=…)`、`print(…, sep=…)` 的值是 None(之前是 `end` 的字串:`x = print(1, end=" ")` 之後 `print(x)` 印空白)。
|
|
14
|
+
- 修正:`type(f).__name__` 照 CPython:`property`、`staticmethod`、`classmethod`、`map`、`filter`、`zip`、`enumerate`、`reversed` 是
|
|
15
|
+
`type`;`random.seed`、`randint`、`randrange`、`choice`、`shuffle`、`uniform` 是 `method`;綁定的內建方法(property 的 `setter`)是
|
|
16
|
+
`builtin_function_or_method`;模組是 `module`。之前全是 `builtin_function_or_method`、`method` 或 `type`。
|
|
17
|
+
- 修正:內建值的方法不呼叫、當值讀(`put = [].append`)判 unknown(`a built-in method as a value`);之前錯判成 AttributeError 的
|
|
18
|
+
accept。
|
|
5
19
|
- **新增 `python.verdictReport`**(和 `python.verdict` 同參數、同型別):判決的 JSON 原封不動,最後多一個 `"steps": N`——這次
|
|
6
20
|
執行用掉的模型步數(單位同 fuel;fuel 用完時等於 fuel;沒跑到執行的是 0)。`python.verdict` 不變。內部:`Lowering.thrown`、
|
|
7
21
|
`Lowering.outcome` 改回傳判決的欄位(`Lowering.fields`),`Lowering.verdictFields` 是欄位與步數。
|
package/README.md
CHANGED
|
@@ -27,6 +27,14 @@ Depends on `@cella-lang/machine`.
|
|
|
27
27
|
(operations that raise `TypeError` whenever they run, with CPython's message, also in code that does not run). An
|
|
28
28
|
operation is tried on a value of each operand's type with the model's own operations; there is no second set of
|
|
29
29
|
typing rules.
|
|
30
|
+
- `python.observedTypes json input fuel`: the types one run saw, `{verdict, nodes, basis}`. `nodes` maps each
|
|
31
|
+
expression's node (and each name an assignment, `for` or `with` binds, and each parameter) to its type as Python's
|
|
32
|
+
typing writes it: `int`, `float`, `str`, `bool`, `None`, a class's name; `list[int]`, `set[str]`,
|
|
33
|
+
`dict[str, int]` with the union of the items' (keys', values') types, `tuple[int, str]` by position; `list[?]`,
|
|
34
|
+
`set[?]`, `dict[?, ?]`, `tuple[()]` when empty. A node whose values had several types gets their union in the order
|
|
35
|
+
first seen (`int|str`). `basis` says `observed` for those, and `unreached` (with the empty text) for a node the run
|
|
36
|
+
did not reach. The types hold for this input only. A run the model cannot finish (`unknown`) or JSON that is not a
|
|
37
|
+
program (`invalid`) gives empty `nodes` and `basis`.
|
|
30
38
|
- `python.session`: the debugger, for `cella-lang/dap`: `load`, `run` (continue, step in, step over, step out, with
|
|
31
39
|
breakpoints), `stopConf`, `stopKind`, `stopNode`, `stopOut`, `stopErr`, `stopDetail`, `feed` (more input),
|
|
32
40
|
`globals`, `frames`, `setVarErr`, `setVarConf`, `env`, and `lines` when the host has the line of each node
|
|
@@ -57,9 +65,9 @@ Each module imports the standard library, `@cella-lang/machine` and the modules
|
|
|
57
65
|
| `python.flattening`, `python.lazy`, `python.sorting` | a generator's body as a continuation; `map`, `filter` and the other lazy built-ins; sorting with the user's comparisons in CPython's order |
|
|
58
66
|
| `python.lowering` | the syntax tree as statements, and the verdict |
|
|
59
67
|
| `python.debugging`, `python.variables` | the debugger's machine (stops as CPython's `line` events); variables, calls and globals as JSON |
|
|
60
|
-
| `python.querying` | the type query |
|
|
68
|
+
| `python.querying` | the type query; the types a run observed |
|
|
61
69
|
| `python.session` | the debugger's entry points |
|
|
62
|
-
| `python` | the entry: `python.verdict`, `python.types` |
|
|
70
|
+
| `python` | the entry: `python.verdict`, `python.types`, `python.observedTypes` |
|
|
63
71
|
|
|
64
72
|
## Assumed
|
|
65
73
|
|