번호 순서대로 훑어보면 언어 기능을 단계적으로 익힐 수 있습니다. 전부 실제로
실행되는 것을 확인했습니다 (make && ./cuffc examples/0X_....cuff).
| 파일 | 보여주는 기능 |
|---|---|
01_hello.cuff |
가장 단순한 print |
02_comprehensive_demo.cuff |
상수, 함수(returnable), is/! 결합, async+await+or_else, 1-Based 리스트, loop repeat+stop, use DLC:/use ... from ... — 명세 문서의 종합 검증 코드 그대로 |
03_pattern_matching.cuff |
match/find/replace/split/count, 이름 있는 캡처(<name:...>), 번호 캡처, [one:...], IS 대소문자 무시, 이스케이프(\.) |
04_collections.cuff |
리스트/맵 add/change/remove, 슬라이싱([2~4], 음수 인덱스), or_else로 인덱스 초과 복구 |
05_scoping_and_globals.cuff |
함수 레벨 스코프, change x to global |
06_error_recovery.cuff |
or_else가 실패한 선언을 어떻게 복구하는지 |
07_functions_async.cuff |
재귀 returnable 함수, async+returnable 조합 |
08_dlc_libraries.cuff |
DLC:math/DLC:string/DLC:random/DLC:list/DLC:convert (함수 이름은 math_sqrt, str_upper, list_sort처럼 라이브러리_동사 형태) |
09_modules_demo.cuff + lib/greetings.cuff |
use <이름> from <경로>로 다른 .cuff 파일 불러오기 |
10_async_ordering.cuff |
await 없이 부른 async 함수가 동기 코드가 끝난 뒤 큐 순서대로(FIFO) 실행되는 것 확인 (협력적 스케줄링이며 동시 실행이 아님) |
11_utf8_strings.cuff |
한글 등 멀티바이트 문자열의 UTF-8 코드포인트 기준 인덱싱/슬라이싱/length() |
12_closures.cuff |
중첩 함수, 클로저 반환/인자 전달, 재귀 클로저, 값 캡처의 동작(숫자는 호출 사이에 누적되지 않고 리스트는 공유됨) |
13_filesystem.cuff |
DLC:filesystem: file_write/file_add/file_readlines/file_size/file_remove (스크립트 폴더 안에서만, 임시 파일은 스스로 정리) |
02_comprehensive_demo.cuff가 참조하는 maps/core_engine/stage_data.cuff |
위와 같은 커스텀 모듈 로딩의 두 번째 예시 |
일부러 실패하도록 만든 스크립트들 — 각 에러 종류가 실제로 어떤 메시지를 내는지
확인하는 용도입니다. (or_else로 감싸지 않았으므로 전부 0이 아닌 종료 코드로
끝나는 게 정상입니다.)
for f in examples/error_cases/*.cuff; do
echo "--- $f ---"
./cuffc "$f"
donemake
./cuffc examples/01_hello.cuff
./cuffc --ast examples/01_hello.cuff # 실행 대신 토큰/AST만 보기