@cella-lang/cpp 0.1.202610270238 → 0.1.202610300318
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 -1
- package/README.md +30 -29
- package/cpp.arrays.cell +0 -0
- package/cpp.cell +0 -0
- package/cpp.classes.cell +0 -0
- package/cpp.classrules.cell +0 -0
- package/cpp.construction.cell +0 -0
- package/cpp.constructs.cell +0 -0
- package/cpp.copies.cell +0 -0
- package/cpp.exceptions.cell +0 -0
- package/cpp.inheritance.cell +0 -0
- package/cpp.lambdas.cell +0 -0
- package/cpp.layouts.cell +0 -0
- package/cpp.library.cell +0 -0
- package/cpp.library.lists.cell +0 -0
- package/cpp.library.strings.cell +0 -0
- package/cpp.library.vectors.cell +0 -0
- package/cpp.memberpointers.cell +0 -0
- package/cpp.names.cell +0 -0
- package/cpp.objects.cell +0 -0
- package/cpp.operators.cell +0 -0
- package/cpp.overloading.cell +0 -0
- package/cpp.polymorphism.cell +0 -0
- package/cpp.primitives.cell +0 -0
- package/cpp.ranges.cell +0 -0
- package/cpp.references.cell +0 -0
- package/cpp.runtimetypes.cell +0 -0
- package/cpp.standardexceptions.cell +0 -0
- package/cpp.standardfunctions.cell +0 -0
- package/cpp.standardnames.cell +0 -0
- package/cpp.staticmembers.cell +0 -0
- package/cpp.streams.cell +0 -0
- package/cpp.templates.cell +0 -0
- package/cpp.userconversions.cell +0 -0
- package/index.json +3894 -7104
- package/package.json +39 -6
package/CHANGES.md
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
# @cella-lang/cpp 的變更
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
給使用這個套件的工具看的 API 變更。
|
|
4
4
|
雜湊(每個定義的 own/merkle,見 `index.json`)在不穩定期可能改變;下面列出改變的定義。
|
|
5
5
|
|
|
6
6
|
## 未發佈
|
|
7
7
|
|
|
8
|
+
- **不相容**:淺嵌入整個拿掉,C++ 程式改由深嵌入的分支服務。程式是 `@cella-lang/cfamily` 語法的 JSON(`"lang": {"k": "langCpp"}`、
|
|
9
|
+
沒有板子),入口是 `cpp.verdict src input fuel`、`cpp.types src candidates` 與除錯器(`load`、`run`、`stopKind`…、`report`);kernel
|
|
10
|
+
判決是 `kernel_verdict_in("cpp", "cpp.verdict", …)`。依賴 `@cella-lang/cfamily` 與 `@cella-lang/machine`。有板子的程式由
|
|
11
|
+
`@cella-lang/arduino` 服務。
|
|
12
|
+
- 判決的條文引 C++17(`C++17 [expr]p4` 等,之前寫 C11 的);C 的標準函式庫照舊引 C11。文字照 UTF-8(`"héllo"` 的 `size()` 是 6)。
|
|
13
|
+
- 改判(之前判錯的):經 `void*` 以錯的型別讀判 reject([basic.lval]p8);有 const 或參考成員的類別整體賦值判 reject(隱式的賦值被
|
|
14
|
+
刪除);C++17 的有號左移(`1 << 31`)、初始值省略大括號、`const std::string` 的物件照 clang 執行;函式庫的 class 沒有的成員
|
|
15
|
+
(`v.reserve(4)`)判 unknown;class 型別的成員沒給初始值時照預設成員初始值。
|
|
16
|
+
|
|
17
|
+
## 0.1.202610291317 與之前
|
|
18
|
+
|
|
19
|
+
這一段寫成時沒有照版本切開,跟著 0.1.202610291317 與之前的版本陸續發出。裡面多半是淺嵌入的 API(`cpp.IntN`、`c.Mem`、`cpp.Debugger`…),淺嵌入已整個拿掉,這些名字都不存在了,只留作紀錄。
|
|
20
|
+
|
|
8
21
|
- **不相容**:`IType` 多一個欄位 `plain`(`itype signed rank width plain`),只有 `tChar` 是 true:plain `char` 與 `signed char`、`unsigned char` 是三個型別([basic.fundamental]p1),`eqIType` 分得出來;值的運算不變。新的 `isPlain`;`wrapSIn`、`wrapUIn` 多一個參數 `p`;`ofIntN`、`toIntN` 的型別是非 plain 的。雜湊改變:`IType` 與用到它的定義。
|
|
9
22
|
|
|
10
23
|
- 除錯器的宿主介面多兩個函式:`cpp.stopKind`(停止種類的名字)、`cpp.dbgReport d input fuel`(輸入一次給完並關閉,跑到停下,回傳停止種類、節點、輸出、細節的 JSON;`cella diff-translation` 執行 `runDef` 用)。
|
package/README.md
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
# @cella-lang/cpp
|
|
2
2
|
|
|
3
|
-
C++
|
|
3
|
+
C++17 for the [Cella](https://www.npmjs.com/package/cella-lang) proof checker, as a compiled module pack: the C++ branch
|
|
4
|
+
of the C family's deep embedding (`@cella-lang/cfamily`). A program is checked by C++17's rules and run by a small-step
|
|
5
|
+
semantics; the verdict is accept, reject or unknown, with the node and the clause of the standard.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
undefined behaviour, and division truncates toward zero. This library defines the C++ semantics directly:
|
|
7
|
+
Depends on `@cella-lang/cfamily` and `@cella-lang/machine`.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
- `cpp.add` / `sub` / `mul` / `neg` / `div` / `rem` take the "no overflow / no division by zero" precondition as an argument
|
|
10
|
-
(for concrete values, `(cpp.inRange refl)` and `refl`); `cpp.lt` / `le` / `eq` have none;
|
|
11
|
-
- correspondence theorems with ℤ (`cpp.toInt_add` …, `cpp.toInt_inj`) proved once for every width;
|
|
12
|
-
- platform profiles: `cpp.lp64.Int` (32 bits) / `cpp.lp64.Long` (64), `cpp.avr.Int` (16) / `cpp.avr.Long` (32);
|
|
13
|
-
- `cpp.Int32` is the LP64 `int`.
|
|
9
|
+
## Programs
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
The JSON of `cfamily`'s syntax with `"lang": {"k": "langCpp"}` and no board (a program for a board is
|
|
12
|
+
`@cella-lang/arduino`'s). The branch covers classes (inheritance, virtual functions and virtual bases, constructors,
|
|
13
|
+
destructors and copies), templates and overloading, references and move semantics, lambdas, exceptions and the
|
|
14
|
+
standard exceptions, iostream input and output, and `std::vector`, `std::string` and `std::initializer_list`, which
|
|
15
|
+
are written in C++ and checked by the same rules as the program.
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
A value the standard leaves to the implementation is libc++'s, and the verdict says it assumed so (`assumes`). A
|
|
18
|
+
standard function, or a member of a library class, that the model does not provide yet makes the verdict unknown with
|
|
19
|
+
the reason, not a rejection.
|
|
20
|
+
|
|
21
|
+
## Entries
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
`
|
|
23
|
+
- `cpp.verdict src input fuel`: the verdict JSON (format in `@cella-lang/cfamily`); `input` is standard input, `fuel`
|
|
24
|
+
bounds the steps. A verdict proved by the kernels: `kernel_verdict_in("cpp", "cpp.verdict", …)` in `cella-lang`.
|
|
25
|
+
- `cpp.types src candidates`: the type query (format in `@cella-lang/cfamily`).
|
|
26
|
+
- The debugger, for `cella-lang/dap`: `load`, `run`, `stopConf`, `stopKind`, `stopNode`, `stopOut`, `stopErr`,
|
|
27
|
+
`stopDetail`, `divergences`, `feed`, `globals`, `frames`, `setVarErr`, `setVarConf`, `env`; and `report input fuel
|
|
28
|
+
session`, a whole run with all the input given at once.
|
|
29
|
+
|
|
30
|
+
## Loading
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// 1. the standard modules it needs: index.requires["cella-lang"].modules (from cella-lang's own modules/)
|
|
31
|
-
for (const m of JSON.parse(index).requires['cella-lang'].modules) load_module_pack(await bytes(assets.module(m)));
|
|
32
|
-
// 2. the library itself — refused with a reason if the checker or format does not match
|
|
33
|
-
const r = JSON.parse(load_library_pack(index, 'cpp', await bytes(new URL('./cpp.cell', libUrl))));
|
|
34
|
-
if (!r.ok) throw new Error(r.error);
|
|
35
|
-
```
|
|
32
|
+
Load the packs into the `cella-lang` build named by `index.json` (`checkerHash`, `cbfVersion`; the `peerDependencies`
|
|
33
|
+
pin it): the standard modules in `index.requires["cella-lang"].modules`, the packages in `index.requires.packages`
|
|
34
|
+
(each the same way), then this package's modules in the order of `index.modules.cpp.deps`. `cella-lang`'s README
|
|
35
|
+
(*Official packages*) has the code.
|
|
36
36
|
|
|
37
37
|
## Per-definition hashes
|
|
38
38
|
|
|
39
|
-
`index.json` lists, for every definition, `own` (its own content) and `merkle` (its content
|
|
40
|
-
|
|
39
|
+
`index.json` lists, for every definition, `own` (its own content) and `merkle` (its content and everything it depends
|
|
40
|
+
on). A definition whose `merkle` did not change between two versions means the same; a changed one is listed in
|
|
41
|
+
`CHANGES.md`.
|
package/cpp.arrays.cell
ADDED
|
Binary file
|
package/cpp.cell
CHANGED
|
Binary file
|
package/cpp.classes.cell
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/cpp.copies.cell
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/cpp.lambdas.cell
ADDED
|
Binary file
|
package/cpp.layouts.cell
ADDED
|
Binary file
|
package/cpp.library.cell
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/cpp.names.cell
ADDED
|
Binary file
|
package/cpp.objects.cell
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/cpp.ranges.cell
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/cpp.streams.cell
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|