-
Notifications
You must be signed in to change notification settings - Fork 0
Projects and Modules
james-yusuke edited this page Jul 16, 2026
·
1 revision
YCPLは単一.ycファイル、directory、またはYCPL.jsonを持つprojectを
コンパイルできます。
{
"name": "my_project",
"version": "0.1.0",
"entry": "src/main.yc",
"src": ["src/"],
"output": "build/"
}src directoryは再帰走査されます。source discoveryはsymlinkをstatで追跡し、
device/inodeで循環を防ぎます。見つかった.yc sourceはproject-relative pathで
sortされ、この安定順にfile IDが割り当てられます。
import path
├─ "."で始まるrelative path
├─ projectのsrc directory
├─ stl/std
└─ stl/c
各候補ではpath.ycとpath/index.ycを探索します。
import "math/basic" as math
import "std/fmt" as fmt
import "c/string" as cstr
std/*は言語レベルの標準API、c/*はC、POSIX、LLVMのraw ABI境界です。
module math
pub fn add(a i32, b i32) i32 {
return a + b
}
fn helper() i32 {
return 1
}
import側はmath.add(...)を呼べますが、privateなhelperは参照できません。
公開function symbolはmodule名を含めてmangleされ、entry pointのmainは
mainのままです。
ycc build
ycc build-ir
ycc run
ycc check
ycc resolvedriverはbuild、build-ir、run、debug、lex、parse、check、
resolve、help、-o、--keep-obj、--link-llvm、--以降の実行引数を
扱います。