aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--docs/design/001-language-v0.md2
-rw-r--r--docs/design/002-dsl-direction.md18
3 files changed, 23 insertions, 5 deletions
diff --git a/README.md b/README.md
index 89f7f41..c900e6a 100644
--- a/README.md
+++ b/README.md
@@ -9,17 +9,19 @@ aup는 [Pure](/srv/git/pure.git) 런타임을 위한 **언어와 툴체인**이�
| **aup** | 언어와 툴체인. 소스 → 진단 → Pure 모듈 |
| [Vega](/srv/git/vega.git) | aup와 Pure 위의 인터페이스 구현자(TUI·CLI·GUI·NUI) |
-상태: v0a(scalar 상태·키 입력·원자적 이벤트·보기)와 v0b의 바이트·영속 문서·메시지·응답 동작.
-다음은 text와 커서.
+상태: v0a(scalar 상태·키 입력·원자적 이벤트·보기)와 v0b(바이트·영속 문서·메시지·응답·text·커서) 동작.
+다음은 v0c(레코드·리스트·`index of`·순수 함수·모듈).
[언어 v0](docs/design/001-language-v0.md).
```sh
make # build/aup
build/aup build examples/counter.aup -o counter.pmod
printf 'down tap\nup tap\nshow\n' | ../pure/prototypes/connections/build/pure-run counter.pmod
+build/aup build examples/notes.aup -o notes.pmod
+printf 'type typed %s\ndown left\nshow\n' "$(printf '안녕' | xxd -p)" | ../pure/prototypes/connections/build/pure-run notes.pmod
build/aup build examples/editor.aup -o editor.pmod
../pure/prototypes/connections/build/pure-edit-module --module editor.pmod --store /tmp/docs show note
-make check # Pure 검증, 결정성, 진단, 워크벤치·기존 편집기와의 대조
+make check # Pure 검증, 결정성, 진단, 워크벤치·기존 편집기·text 참조 모델과의 대조
```
`make check`는 옆의 Pure 체크아웃(`PURE=../pure/prototypes/connections`)의 검증기와 시험 호스트를 쓰고,
diff --git a/docs/design/001-language-v0.md b/docs/design/001-language-v0.md
index 898d7c7..5be574d 100644
--- a/docs/design/001-language-v0.md
+++ b/docs/design/001-language-v0.md
@@ -1,6 +1,6 @@
# aup v0 — 한 언어, 한 모듈 형식
-2026-09-25. 상태: v0a(scalar)와 v0b의 바이트·영속 문서 부분 구현. text·커서는 [002](002-dsl-direction.md)에서 다음에 구현.
+2026-09-25. 상태: v0a(scalar)와 v0b(바이트·영속 문서·text·커서) 구현. text 문법은 [002](002-dsl-direction.md).
착수 기준:
diff --git a/docs/design/002-dsl-direction.md b/docs/design/002-dsl-direction.md
index ff5b418..2b419c9 100644
--- a/docs/design/002-dsl-direction.md
+++ b/docs/design/002-dsl-direction.md
@@ -63,8 +63,24 @@ view current = note.line(at) # 커서가 있는 줄. 복사하지 않�
| 단계 | 들어가는 것 | 합격 기준 |
|---|---|---|
| v0a ✅ | 스칼라 상태, 키 입력, 핸들러, 보기 | 워크벤치 엔진과 비트 단위 일치 |
-| v0b | `bytes`, 키별 영속 문서, `message` 입력, 응답, `require` ✅ / `text`(리터럴·보간·`cursor in`·`char`/`line`), `text` 입력 | 기존 편집기 CLI와 바이트 단위 일치 ✅ / TUI 동작 |
+| v0b ✅ | `bytes`, 키별 영속 문서, `message` 입력, 응답, `require`, `text`(리터럴·보간·`cursor in`·`char`/`line`), `text` 입력 | 기존 편집기 CLI와 바이트 단위 일치, text 편집이 참조 모델과 일치 |
| v0c | `i64 bool`, `record`, `list`/`map`, `index of`, 순수 `fn`, `use` 모듈 | 모든 연산에 실행량 상한 |
| v0d | `use vega`로 첫 인터페이스 투영(목록·표·커서·톤) | 한 명세가 두 표면 이상에서 동작 |
+### 구현된 text (v0b)
+
+`examples/notes.aup`가 작은 편집기 전체다. 위 문법 중 다음을 구현했다.
+
+- `text` 상태·문자열 초기값, 문자열의 이스케이프와 `{보간}`(수와 text), `input 이름 = text`
+- `cursor in 이름`, `char`/`line` 거리, `.start`/`.end`, `insert`/`remove`, `.line(커서)`
+- text의 `.chars`/`.lines`/`.bytes`, 커서의 `.chars`(처음부터 센 글자 수)와 `.line`(줄 번호)
+- `text(bytes)`/`bytes(text)`. 응답과 문서 `replace`는 text를 UTF-8 바이트로 받는다.
+
+`char`는 Unicode scalar다. 여러 줄 문자열, `{price:.2}` 같은 형식 지정, grapheme과 `word`는 아직 없다.
+삽입 위치에 있던 커서는 모두 삽입한 글자 뒤로 간다(입력 커서와 표시가 같은 규칙). 보간 안에는 문자열을 쓸 수 없다.
+
+검증: 무작위 입력(ASCII·한글·이모지·결합 문자·NUL·줄바꿈)과 이동·지우기 4,800단계에서 본문, 커서, 표시,
+보기가 Python 참조 모델과 같다. 이스케이프와 숫자 표시(`1e+21`, `0.30000000000000004`, `2.5e-7`, `-0`은 `0`)를
+확인한다. 컴파일러와 Pure 실행기를 각각 sanitizer로 빌드해 같은 검사를 통과했다.
+
구현은 C로 손수 쓴 재귀 하강 파서를 유지한다. 문법은 EBNF로 문서화하고, 이후 `aup fmt`와 언어 서버를 붙인다.