aboutsummaryrefslogtreecommitdiffstats
path: root/docs/design/027-computation-core.md
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-18 20:01:08 +0100
committereunhhu <[email protected]>2026-10-18 20:01:08 +0100
commit936c08e3424c606855051ee86f25a7df0f162c62 (patch)
tree94870b4892d616e420bf259f3031f960c4bf28cc /docs/design/027-computation-core.md
parentb22b8c3f6c5378b47c36370225d7c41d4394bb7c (diff)
downloadpure-936c08e3424c606855051ee86f25a7df0f162c62.tar.gz
pure-936c08e3424c606855051ee86f25a7df0f162c62.zip
Module format v7, 027's 4c: cursors and indices one anchor: a module's state type 2 is a place in the text or the list it names (a bool 4, an i64 5), and seven anchor instructions take the place of the thirteen of cursors and indices (103 opcodes now 97): LOAD and STORE an anchor state, START and END of a text or a list, MOVE, COUNT and AT naming it and a unit (a character, a line, an item); the load holds an anchor in a text as a cursor and in a list as an index (a mark in a list refused) and each anchor instruction as the runtime's own one for it (PURE_OP_CUR_*, PURE_OP_INDEX_*, numbered past a module's in module-run.h with the kept lists' steps; a module holding one refused), so the executor's, the batches' and the JIT's steps are those they were; the verifier holds MOVE, COUNT and AT to the text or list they name; new: AT in a text (a cursor so many characters or lines from its start, not_found past the end); COUNT's lines from 0; unit test anchors (AT and COUNT in a text, AT in a list, four refused); the tests' modules written with the anchor instructions; counts: b34 against b33 with batches matmul -1.36%, the rest within 0.08%, without batches within 0.04%; the bank's queries (six each, s33 on the 4b-2 aup's module) in_credit +0.28%, per_branch +0.23%, ranks +0.10%, the rest 0.00%; 008 and 027
Diffstat (limited to 'docs/design/027-computation-core.md')
-rw-r--r--docs/design/027-computation-core.md35
1 files changed, 34 insertions, 1 deletions
diff --git a/docs/design/027-computation-core.md b/docs/design/027-computation-core.md
index 239a784..b0a2971 100644
--- a/docs/design/027-computation-core.md
+++ b/docs/design/027-computation-core.md
@@ -299,11 +299,44 @@
- 구현은 대상의 종류로 나뉜다. 로드가 형식의 명령을 대상에 맞는 내부 명령(지금의 CUR_*와 INDEX_*의 걸음)으로 바꿔
쓰고, 검증은 그것에 대해 지금처럼 한다. 그래서 실행기, 묶음 실행기, JIT의 길은 그대로다. 026의 원칙(뜻은 일반적으로,
특수화는 구현 아래로)이다.
+ - **만듦(2026-10-18).**
+ - 형식: 상태 종류 2가 앵커다(bool 4, i64 5). 명령은 103개에서 97개가 되었다. 앵커 명령 일곱의 MOVE·COUNT·AT는 인자에
+ 대상과 단위를 적는다(`PURE_ANCHOR_UNIT`).
+ - 로드: 앵커 상태는 대상이 text면 커서, 리스트면 인덱스로 둔다(리스트 안의 마크는 거절). 앵커 명령은 런타임의 명령
+ (`PURE_OP_CUR_*`, `PURE_OP_INDEX_*`: module-run.h, 모듈 명령 다음 번호)으로 바뀐다. 모듈이 그 번호를 담으면 거절한다.
+ 검증기는 MOVE·COUNT·AT가 적은 대상과 피연산자의 주인이 같은지 본다. 3단계의 내부 명령(`PURE_OP_KEPT_*`)도 그 표로 옮겼다.
+ - 새 것: text의 AT(처음부터 n 글자나 n 줄 뒤의 커서, 끝을 넘으면 `not_found`). COUNT의 줄은 0부터 센다(aup의 `at.line`이
+ 1을 더한다).
+ - aup는 컴파일러 안의 커서와 인덱스를 그대로 두고, 명령 번호와 상태 번호를 형식대로 낸다.
+ - 시험: 단위 시험 `anchors`(text의 AT와 COUNT, 리스트의 AT, 거절 넷). 시험의 모듈 짓기는 런타임의 명령 이름을 형식의 앵커
+ 명령으로 옮겨 쓴다.
+ - 명령 수(b34 대 b33): 묶음 matmul −1.36%, knapsack −0.08%, BFS +0.03%, 실행기만은 ±0.04% 안이다. 은행 질의(s33은 4b-2의 aup
+ 모듈, s34는 4c의 것, 각 여섯 번의 중앙값)는 in_credit +0.28%, per_branch +0.23%, ranks +0.10%, 나머지 0.00%다. 이 셋은 같은
+ 빌드에서도 1–2% 오간다.
- **4d. 입력은 메시지 하나(의심 1).**
- 키, text, 타이머, 프레임, 가리킴은 표면과 호스트가 만드는 메시지다.
- 모듈의 입력은 메시지(필드들)와 표면이 읽는 묶음(키 이름, text, 주기, 프레임)이다. 묶음을 해석하는 것은 표면이고, Pure는 메시지만
받는다.
- - `dt`는 프레임 메시지의 필드가 된다. 키의 누름과 뗌은 메시지의 bool 필드다.
+ - `dt`는 프레임 메시지의 필드가 된다. 키의 누름과 뗌은 각각의 메시지다.
+ - **설계(2026-10-18).**
+ - 입력 항목은 메시지, 출력, 인자의 셋이다. 메시지는 묶음(binding)을 하나 가질 수 있다. 묶음은 표면과 호스트에게 무엇이
+ 그 메시지를 만드는지 알려 준다(묶음의 필드는 정해져 있다):
+ - 키 누름 `이름`, 키 뗌 `이름`: 그때마다 메시지 하나, 필드 없음(누름은 이름 붙은 동작이다: 접근성이 그것을 읽는다)
+ - text: 들어온 text마다, 필드 `text: text`
+ - 주기 `ms`: 틱마다, 필드 없음(시각은 늘 그렇듯 `now`)
+ - 프레임: 화면의 한 장마다, 필드 `dt: number`
+ - 가리킴 `보기`: 표의 행을 가리킬 때, 필드 `position: u32`
+ - Pure의 코어는 묶음을 해석하지 않는다. 묶음의 필드가 맞는지만 검증한다. 핸들러의 이벤트는 입력의 번호다(누름과 뗌의 두
+ 이벤트, 프레임의 이벤트 0이 없다).
+ - 빠지는 것: 입력 종류 키·text·타이머, 프레임 이벤트(이벤트 0), `pure_app_input`·`tick`·`text`·`frame`·`point`, 명령 DT와
+ TEXT_INPUT(필드 읽기가 한다). 호스트는 묶음대로 메시지를 짓는다.
+ - 저장: 프레임 메시지도 다른 메시지처럼 저장한다. 초당 60번 저장하지 않으려면 호스트가 묶음 저장을 쓴다(Vega는 프레임이 아닌
+ 입력 뒤에 저장한다). Pure는 어느 메시지가 프레임인지 모른다.
+ - aup: 겉은 그대로다. `input up = key ArrowUp`의 `on up.down { … }`은 누름 메시지의 핸들러로, `on up.up { … }`은 숨은 뗌 입력의
+ 핸들러로,
+ `on frame`과 `dt`는 숨은 프레임 입력과 그 필드로, `input typed = text`의 `typed`는 그 필드로 낸다. `view X_focus =
+ at.position`은 숨은 가리킴 입력과 `at`을 옮기는 핸들러를 낸다(그래서 앱이 바뀌지 않는다).
+ - Vega: 키, text, 타이머, 프레임, 가리킴을 묶음을 보고 메시지로 보낸다. serve: 키와 text의 POST를 메시지로, 타이머를 주기 묶음으로.
- **4e. 보기는 아무 값(의심 2).**
- 보기의 타입은 레코드 필드의 타입이다. 표는 레코드의 리스트를 내는 보기이고, 열은 그 레코드의 필드다.
- 게으른 칸 계산과 한 번 훑는 집계는 그 구현으로 남는다. 항목이 리스트를 담을 수 있고, 보기의 본문이 지은 리스트도 낼 수 있다.