Go (1.18-1.23+)
1. Supported Versions & File Extensions
Section titled “1. Supported Versions & File Extensions”- Language Standard: Go 1.18 through 1.23+
- Recognized Extensions:
.go - Stdin Flag:
-l go - Measured Throughput (
v0.4.0):95.4 usByteString SIMDGo BSlexer (Small ~85 LOC,RQ7);1.83 msfull Go pipeline (~100 LOC,RQ2);33,956 LOC/scold and15.18×warm speedup on 994-fileprometheus
2. Supported Constructs & Package Directory Merging
Section titled “2. Supported Constructs & Package Directory Merging”Canontra’s pure-Haskell ByteString-native Go frontend (Canontra.Parser.Go) supports:
- Package Directory Merging (
WholeRepoGraph):.gofiles sharing a package directory merge into one package symbol namespace forF_WCGandF_WDFresolution. - Go 1.21+ Builtins: Recognizes
min,max, andclearcalls cleanly during call-graph and data-flow analysis. - Generics & Tilde Constraint Sets (
~T): Type parameter lists (func Map[K comparable, V any](...)) and union/approximation constraints (~int | ~float64). - Concurrency & Control Flow: Goroutines (
go fn()), channel sends/receives,selectstatements,switch/type switch,deferblocks,for/rangeloops, and factoredimport/type/const/varblocks. - Declarations & Receivers: Package declarations, functions, methods with pointer/value receivers,
structtypes, andinterfacemethod sets.
3. Language-Specific Alpha Scoping & F_T Rules
Section titled “3. Language-Specific Alpha Scoping & F_T Rules”- Short Variable Redeclaration (
canonicalizeAlphaModuleForLang): Honors Go’s:=block-scoping and multi-assignment redeclaration rules (reusing an existing variable in the same block vs. allocating a fresh@v<depth>.<ordinal>in a nested block). - Export Visibility & ABI Scalar Widths (
F2/F_T): Capitalized exported functions, struct fields, and interface methods governF2andF_T; fixed-width scalars (int32vsint64,uint32vsuint64,float32vsfloat64) remain strictly distinct inF_T. - Constraint Sorting & Recursive Struct Breaker: Union constraints (
~int | ~float64vs~float64 | ~int) flatten and sort canonically inF_T, type parameters map toα0,α1, and self-referential structs terminate cleanly withTypeRecVar 0.
4. Unsupported & Conservative-Fallback Constructs
Section titled “4. Unsupported & Conservative-Fallback Constructs”- Cgo (
import "C"): Inline C preamble comments andC.*symbols are hashed as external dependency tokens inF3andF_CG; Canontra never runs a C compiler or parses C headers. //go:generateDirectives: Treated as comments until generated.gofiles exist on disk.reflectPackage Dispatch: Dynamic method lookups and struct tag reflection (reflect.ValueOf) do not synthesize speculative call edges inF_WCG.