The standard YCPL compiler, ycc, is implemented in YCPL. The C++
ycc-bootstrap executable is retained only as the initial seed and reference.
ycc-bootstrap (C++)
-> ycc-stage1 (YCPL)
-> ycc-stage2 (YCPL)
-> ycc-stage3 (YCPL)
-> ycc
└─ ycc-ycpl
Only stage1 is generated by C++. Stage1 generates stage2, stage2 generates
stage3, and stage3 is promoted as the standard ycc.
Configure LLVM 22 and let Bazel generate every stage:
eval "$(scripts/setup-llvm.sh 22 --print-env)"
bazel build \
//:ycc-bootstrap \
//:ycc-stage1 \
//:ycc-stage2 \
//:ycc-stage3 \
//:ycc \
//:ycc-ycpl
bazel test //:self_host_stage_test //:ycc_ycpl_test
bazel test //...The fixed-point test:
- Generates the compiler's LLVM IR with stage2 and stage3.
- Canonicalizes both through LLVM 22
llvm-asandllvm-dis. - Stabilizes only ModuleID and source filename, then compares them exactly.
- Builds and runs hello with both stage2 and stage3.
- Applies the same expanding conformance suite to both compilers.
- Checks that promoted
ycccontains no bootstrap/fallback route strings.
eval "$(scripts/setup-llvm.sh 22 --print-env)"
bazel build //:ycc-bootstrapThe executable is bazel-bin/ycc-bootstrap. To generate the compiler project
manually, run it with compiler/ycpl as the current directory:
mkdir -p /tmp/ycpl-stage1
(
cd compiler/ycpl
../../bazel-bin/ycc-bootstrap build -o /tmp/ycpl-stage1
)
/tmp/ycpl-stage1/ycc check compiler/ycplDo not use ycc-bootstrap build compiler/ycpl ... directly from the repository
root; that does not match the bootstrap driver's project-current-directory
convention.
YCPL_STL_ROOT="$PWD/stl" \
YCPL_RUNTIME_SRC="$PWD/bootstrap/cpp/runtime/yc_runtime.c" \
/tmp/ycpl-stage1/ycc \
build examples/basics/hello.yc -o /tmp/ycpl-hello
/tmp/ycpl-hello/mergedThe expected output is Hello World. Normal use through bazel-bin/ycc or
Bazel runfiles resolves these paths automatically:
bazel run //:ycc -- run examples/basics/hello.yctests/run_conformance.sh ./bazel-bin/yccThe harness accepts any compiler executable and checks positive, negative,
runtime, project/module, standard-library, and c/* FFI behavior against the
same oracle.