CLI Output
対象実装: このドキュメントは NEPLg2.0(現行
nepl-core)の CLI 仕様を記述する。
NEPLg3 では ownership check と Resource IR analysis などの検査が追加される想定であり、ここで説明する現在の CLI 挙動とは一致しない部分がある(doc/neplg3/impl/compiler_structure.md参照)。
This document describes NEPL CLI output options and file naming.
Output base
--output is treated as a base path. Extensions are added depending on --emit.
Examples:
--output out/awritesout/a.wasm,out/a.wat,out/a.min.wat(depending on--emit).--output out/a.wasmis treated as baseout/a.--output out/a.watis treated as baseout/a.--output out/a.min.watis treated as baseout/a.
Targets
--target selects the compilation target (default: wasm):
| Target | Description |
|---|---|
wasm | Pure WebAssembly (no WASI imports) |
wasi | WebAssembly with WASI syscalls |
llvm | Native binary via LLVM |
The current compiler keeps typecheck / effect-check behavior consistent across targets. Only the physical layout and allocator differ (absorbed by #if[target="..."] in stdlib). NEPLg3 is planned to add ownership check and Resource IR analysis uniformly across all targets.
Emit formats
--emit accepts one or more values (comma-separated or repeated). Applies to Wasm targets:
wasmoutputs the binary.wasm.watoutputs a readable WAT.wat-minoutputs a minified WAT.allexpands towasm,wat,wat-min.
Examples:
nepl-cli --input examples/counter.nepl --output target/counter --emit wasm
nepl-cli --input examples/counter.nepl --output target/counter --emit wat
nepl-cli --input examples/counter.nepl --output target/counter --emit wasm,wat,wat-min
Profile
--profile controls #if[profile=...] gates in source:
--profile debugenables#if[profile=debug]--profile releaseenables#if[profile=release]
If omitted, the source profile defaults to debug. This keeps source
conditional compilation deterministic even when the compiler executable or Web
artifact is built in release mode for speed.
Run and program arguments
When --run is used, arguments after -- are passed to the WASI program.
The program name is always provided as argv[0] (input path or <stdin>).
Example:
nepl-cli --input examples/counter.nepl --run -- --flag value
WAT generation
- Pretty WAT uses the default formatting from
wasmprinter. - Minified WAT compresses whitespace after printing.