Files
five/docs/todo.md
Charles KWON OhJun 59568f3301 Five v0.9 — Harbour + Go fusion language
- Compiler: PP → Lexer → Parser → Analyzer → Gengo pipeline
- Parser: 232/236 (98%) Harbour compatibility, registry-based dispatch
- RTL: 351 Harbour-compatible functions
- RDD: DBF/NTX/CDX engines with Rushmore bitmap optimization
- Go Interop: IMPORT + pkg.Func() + obj:Method() with FastPath (15M calls/sec)
- HB_FUNC API: Full Harbour C API compatible Go bridge
- Concurrency: SPAWN/LAUNCH/GOROUTINE, <-, WATCH, PARALLEL FOR, ASYNC/AWAIT
- Extensions: Multi-return, DEFER, Slice, f-string, Nil-safe ?:, CONST
- Macro Compiler: Runtime AST parsing and evaluation
- Debugger: TUI debugger with source display, breakpoints, stepping
- FRB: Native + Pcode dual mode runtime binary
- Tests: 13 packages ALL PASS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 09:41:50 +09:00

156 lines
6.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Five Development TODO
> Copyright (c) 2026 Charles KWON OhJun (charleskwonohjun@gmail.com)
> All rights reserved.
---
## Phase 0: 프로젝트 기반 — ✅ 완료
- [x] 0.1 Go 모듈 초기화 + 디렉토리 구조 + .gitignore + LICENSE
- [x] 0.2 Tagged Value 24B 구현 (`hbrt/value.go`) — tsgo 교훈: GC-safe unsafe.Pointer
- [x] 0.3 Value 테스트 49개 PASS + 벤치마크 (스칼라 0 alloc 확인)
---
## Phase 1: 최소 런타임 — ✅ 완료
- [x] 1.1 Thread + Stack (`hbrt/thread.go`) — Frame, EndProc, push/pop, locals
- [x] 1.2 산술 연산 (`hbrt/ops_arith.go`) — Plus~Power + AddInt, LocalAdd 등 최적화 4종
- [x] 1.3 비교 연산 (`hbrt/ops_compare.go`) — Equal~GreaterEqual + And/Or/Not + PopLogical
- [x] 1.4 문자열 연산 — Plus에서 String+String 처리
- [x] 1.5 심볼 테이블 (`hbrt/symbol.go`) — Symbol, Module, Registry
- [x] 1.6 함수 호출 (`hbrt/call.go`) — PushSymbol, Function, Do, 중첩 호출 (pendingSyms 스택)
- [x] 1.7 기본 RTL (`hbrtl/`) — QOut, Str, Val, Len, SubStr, Upper, Lower, AllTrim, Space, PadR/L
- [x] 1.8 VM 초기화 + Hello World (`hbrt/vm.go`) — 6개 통합 테스트 PASS
---
## Phase 2: 컴파일러 프론트엔드 — ✅ 완료
- [x] 2.1 토큰 정의 (`compiler/token/token.go`) — 120+ 종류, Pratt 우선순위 테이블
- [x] 2.2 렉서 (`compiler/lexer/lexer.go`) — 키워드, .T./.AND., 주석 4종, 줄 계속, ?/??
- [x] 2.3 AST (`compiler/ast/ast.go`) — 18 Expr + 15 Stmt + 10 Decl + xBase 명령
- [x] 2.4 파서 (`compiler/parser/`) — Pratt 식 파싱, 제어 흐름, xBase, CLASS, IMPORT
---
## Phase 3: 코드 생성 + CLI — ✅ 완료
- [x] 3.1 Go 코드 생성기 (`compiler/gengo/gengo.go`) — AST → Go 소스 코드
- [x] 3.2 CLI (`cmd/five/main.go`) — `five run`, `five build`, `five gen`
- [x] 3.3 E2E 테스트 — hello.prg, functions.prg 실행 성공
- [x] 3.4 네이티브 바이너리 빌드 — 2.1MB 정적 링크 ELF
---
## Phase 4: RTL 확장 — ✅ 완료
- [x] 4.1 배열 (`hbrtl/array.go`) — AAdd, ADel, AIns, ASize, AClone, ACopy, AFill, ASort, AEval, AScan, ATail
- [x] 4.2 해시 (`hbrtl/hash.go`) — hb_Hash, hb_HGet, hb_HSet, hb_HDel, hb_HHasKey, hb_HKeys, hb_HValues
- [x] 4.3 코드 블록 (`hbrt/ops_collection.go`) — EvalBlock, ArrayGen, HashGen, ArrayPush/Pop
- [x] 4.4 날짜 (`hbrtl/datetime.go`) — Date, Time, Year, Month, Day, DOW, Seconds, DToC, DToS, SToD
- [x] 4.5 E2E — rtl_test.prg 실행 성공 (배열 정렬, 문자열, 타입, 날짜)
---
## Phase 5: RDD — DBF 엔진 ⬜ 진행 예정
### 설계 문서 ✅ 완료
- [x] `docs/dbf-engine-spec.md` — DBF 바이트 포맷, 필드 타입 19종, 6종 락 스키마
- [x] `docs/rdd-architecture-spec.md` — RDD 101-method vtable, 상속 체인, SEEK→Index B-tree
### 5.1 RDD Interface
- [ ] `hbrdd/driver.go` — Driver, Area, Indexer, Locker, Filterer, MemoHandler interface
- [ ] `hbrdd/base.go` — BaseArea (WAAREA 대응, 기본 구현)
- [ ] `hbrdd/workarea.go` — WorkAreaManager (Thread-local)
- [ ] `hbrdd/alias.go` — ALIAS 등록/해제/전환
### 5.2 DBF 코어
- [ ] `hbrdd/dbf/header.go` — DBF 헤더 32B 읽기/쓰기 (LE)
- [ ] `hbrdd/dbf/field.go` — 필드 디스크립터 32B×N, 19종 필드 타입 GET/PUT
- [ ] `hbrdd/dbf/record.go` — 레코드 읽기/쓰기 (오프셋 = headerLen + (recNo-1)*recordLen)
- [ ] `hbrdd/dbf/lock.go` — 6종 락 스키마 전부
- [ ] `hbrdd/dbf/memo.go` — FPT 메모 (헤더 512B, 블록 읽기/쓰기)
- [ ] `hbrdd/dbf/dbf.go` — DBFArea: Open, Close, GoTo, Skip, GetValue, PutValue, Append, Delete, Pack, Zap
- [ ] 호환성 테스트: Harbour DBF ↔ Five DBF 상호 읽기
### 5.3 NTX 인덱스
- [ ] `hbrdd/ntx/header.go` — NTX 헤더 512B
- [ ] `hbrdd/ntx/page.go` — B-tree 페이지 1024B, 페이지 내 이진 검색
- [ ] `hbrdd/ntx/key.go` — 키 변환 (C→패딩, N→정렬문자열, D→YYYYMMDD, L→T/F)
- [ ] `hbrdd/ntx/search.go` — SEEK: 루트→리프 순회 + 스택 + SOFTSEEK/FINDLAST
- [ ] `hbrdd/ntx/skip.go` — SKIP: 스택 기반 NextKey/PrevKey, Scope 검증
- [ ] `hbrdd/ntx/update.go` — 키 삽입 (페이지 분할), 키 삭제 (밸런싱)
- [ ] `hbrdd/ntx/build.go` — INDEX ON (Go goroutine 병렬 키 추출 + 정렬 + 바텀업 빌드)
- [ ] `hbrdd/ntx/ntx.go` — NTXArea: DBFArea 임베딩 + Indexer 구현
- [ ] 호환성 테스트: Harbour NTX ↔ Five NTX
### 5.4 CDX 인덱스
- [ ] `hbrdd/cdx/header.go` — CDX 파일 헤더 1024B, 태그 헤더 512B
- [ ] `hbrdd/cdx/compress.go` — 비트 패킹 (RecBits/DupBits/TrlBits) 인코딩/디코딩
- [ ] `hbrdd/cdx/page.go` — 내부/리프 노드
- [ ] `hbrdd/cdx/search.go` — SEEK (hb_cdxPageSeekKey 재귀 순회)
- [ ] `hbrdd/cdx/update.go` — 삽입/삭제
- [ ] `hbrdd/cdx/cdx.go` — CDXArea: DBFArea 임베딩 + Indexer 구현
- [ ] 호환성 테스트: Harbour CDX ↔ Five CDX
### 5.5 xBase 명령어 연동
- [ ] 컴파일러 gengo: USE/SEEK/REPLACE/APPEND/INDEX/SET/GO/SKIP 코드 생성
- [ ] 런타임: CmdUse, CmdSeek, CmdReplace 등 Thread 메서드
- [ ] SET FILTER TO, SET RELATION TO, (cAlias)->field 동적 별칭
---
## Phase 6: OOP + 매크로 ⬜
- [ ] 6.1 CLASS 시스템 — ClassDef, ClassRegistry, 상속, 연산자 오버로딩
- [ ] 6.2 CLASS 컴파일러 — CLASS→Go struct, DATA→필드, METHOD→메서드
- [ ] 6.3 매크로 컴파일러 — &variable, &(expression) 런타임 파싱
- [ ] 6.4 전처리기 — #include, #define, #command, #pragma
---
## Phase 7: Go 생태계 연동 ⬜
- [ ] 7.1 IMPORT → Go import 변환 + 타입 브릿지 자동 생성
- [ ] 7.2 타입 브릿지 — ToGoValue/FromGoValue, Marshal/Unmarshal
- [ ] 7.3 동시성 — GO(goroutine), CHANNEL, SEND, RECEIVE, WAITGROUP
- [ ] 7.4 HTTP — hbweb (라우팅, JSON, 미들웨어)
- [ ] 7.5 SQL RDD — database/sql 기반 (PostgreSQL, MySQL, SQLite)
---
## Phase 8: 개발 도구 ⬜
- [ ] 8.1 `five fmt` — 코드 포매터
- [ ] 8.2 `five lsp` — Language Server Protocol
- [ ] 8.3 `five test` — 테스트 프레임워크
- [ ] 8.4 VSCode 확장 — 구문 강조, LSP, 스니펫
- [ ] 8.5 `five migrate` — Harbour→Five 마이그레이션 도구
---
## 현재 상태 요약
```
✅ Phase 0~4 완료
테스트: 144개 unit tests PASS + 3개 PRG E2E 실행 성공
파일: 28개 .go + 3개 .prg
바이너리: five CLI (five run/build/gen)
문서: 9개 MD (7,408줄)
참조: ref/typescript-go
⬜ Phase 5 (DBF) ← 다음 (설계 문서 완료, 구현 시작 대기)
⬜ Phase 6~8 대기
```
```
일정:
Phase 0~4 완료 ████████████████████ (1일)
Phase 5 예정 ████████ (4주)
Phase 6 예정 ██████ (3주)
Phase 7 예정 ██████ (3주)
Phase 8 예정 ████ (2주)
```