docs/Compiler-Args-Debugging.md
compiler-args-app.ts is a standalone debugging utility for testing and inspecting compiler argument parsing in Compiler Explorer. It allows you to run the argument parser for different compilers and see what arguments CE can extract and understand.
node --import tsx compiler-args-app.ts \
--parser <compiler-type> \
--exe <path-to-compiler> \
[--padding <number>] \
[--debug]
--parser <type> (required): The compiler parser type to use--exe <path> (required): Path to the compiler executable--padding <number> (optional): Padding for output formatting (default: 40)--debug (optional): Enable debug output for troubleshootingNote: Arguments should NOT use equals signs (=). Use spaces instead: --parser gcc not --parser=gcc
node --import tsx compiler-args-app.ts \
--parser gcc \
--exe /opt/compiler-explorer/gcc-14.2.0/bin/g++ \
--debug
node --import tsx compiler-args-app.ts \
--parser clang \
--exe /opt/compiler-explorer/clang-19.1.0/bin/clang++ \
--padding 50
node --import tsx compiler-args-app.ts \
--parser rust \
--exe /opt/compiler-explorer/rust-1.80.0/bin/rustc
node --import tsx compiler-args-app.ts \
--parser golang \
--exe /opt/compiler-explorer/golang-1.24.2/go/bin/go
gcc - GNU Compiler Collectionclang - Clang/LLVMldc - LDC (D Language)erlang - Erlangpascal - Pascal compilersispc - Intel SPMD Program Compilerjava - Javakotlin - Kotlinscala - Scalavc - Visual C++rust - Rustmrustc - mrustcnum - Nimcrystal - Crystalts - TypeScript Nativeturboc - Turbo Ctoit - Toitcircle - Circleghc - Glasgow Haskell Compilertendra - TenDRAgolang - Gozig - ZigNew parser types have to be added manually to the compilerParsers type list in compiler-args-app.ts
The tool provides several types of information:
Lists all compiler arguments that were successfully parsed, showing:
-O2, --std=c++20)Shows available language standard versions the compiler supports (e.g., C++11, C++14, C++17)
Lists available compilation targets the compiler can generate code for
Shows available editions (primarily for Rust compilers)
Reports on specific compiler features:
supportsOptOutput: Whether optimization output is supportedsupportsStackUsageOutput: Whether stack usage reporting is supportedoptPipeline: Optimization pipeline informationsupportsGccDump: Whether GCC dump output is supportedThe tool also reports which target specification format the compiler uses:
supportsTargetIs: Uses --target=<target>supportsTarget: Uses --target <target>supportsHyphenTarget: Uses -target <target>supportsMarch: Uses --march=<arch>Add --debug to see detailed parsing information and any errors that occur during argument extraction.
If arguments aren't being detected correctly:
Empty or Missing Arguments
--help to see its output formatParser Crashes
ldd to check dependencies)Incorrect Parser Type
gcc parser for a clang compiler) may work partially but miss specific featuresWhen adding support for a new compiler:
lib/compilers/argument-parsers.tscompilerParsers type list in compiler-args-app.tsThis tool is useful when:
The parsed arguments are used by CE to:
optPipeline) when optimization output flags are detectedsupportsGccDump) when dump flags are found