Fin# (Financial Sharp) v0.1.0
Browse Table of Contents (6 chapters)
Getting Started (2)
Language Specification (2)
Compiler & Standard Library (1)
Diagnostics & Proofs (1)
Master Symbol Index
3 min read Module: raggiesoft.finsharp F1: IDH_FIN_STDLIB_CLI (0x3005)

finsc CLI, Standard Library & .NET Compiler Architecture

Fin# (FinSharp.Compiler / finsc) is architected as a clean, fast, 100%-readable self-hosted C# compiler frontend ("Mini-Roslyn" design) targeting .NET 10 / 11 CoreCLR and NativeAOT—interoperating seamlessly with every .NET NuGet library while keeping build times under 3 seconds.

finsc Command-Line Interface Reference

CommandFlags & ArgumentsPurpose
finsc check <file|dir>--diagnostics=json, --strictRuns Lexer -> Parser -> Binder -> LinearFlowAnalyzer (FIN0001–FIN0005) in milliseconds without writing binaries.
finsc build <project.finproj>-o <dir>, --aot, --pdbVerifies all conservation proofs and lowers verified syntax trees via Microsoft.CodeAnalysis.CSharp (Roslyn) into deterministic .dll / .exe assemblies.
finsc audit <ledger.fin>--standard=Z_SOX_302, --jsonExecutes ledger transactions deterministically and emits a SHA-256 Merkle trial-balance attestation report.
finsc fmt <file|dir>--write, --checkComment-preserving source formatter that aligns account, debit, and credit columns cleanly.
finsc lsp--stdioLaunches the JSON-RPC 2.0 Language Server providing real-time red squiggles for FIN0001–FIN0005 and live T-account hover cards.

Standard Library Reference (FinSharp.StdLib)

capital.* — Linear Allocation & Remainder Combinators

Function SignatureReturn TypeDescription
capital.splitEqual(amount: Capital<T>, ways: Int32, policy: RoundingPolicy)(Capital<T>[], Capital<T>)Consumes amount and returns ways equal shares plus an explicit linear remainder so zero sub-cents ever vanish (FIN0005).
capital.allocateByWeights(amount: Capital<T>, weights: Int64[])Capital<T>[]Consumes amount using deterministic Largest-Remainder (Hamilton) allocation guaranteed to sum to amount with zero leftover cents.
capital.combine(left: Capital<T>, right: Capital<T>)Capital<T>Consumes two same-currency bindings (FIN0004 checked) and returns their exact 128-bit fixed-point sum.
capital.assertZero(value: Capital<T>)UnitSafely consumes a linear binding proven to equal 0.00 (for example, an exhausted loop accumulator). Traps in audit mode if non-zero.

fx.* — Multi-Currency Conservation Bridges

Function SignatureReturn TypeDescription
fx.quote<TFrom, TTo>(scaledRate: Fixed128, timestampUtc: String, providerId: String)Rate<TFrom, TTo>Creates an immutable, timestamped foreign-exchange quote using 8-decimal-place scaled fixed-point math (FIN0003 float-free).
fx.convert(source: Capital<TFrom>, quote: Rate<TFrom, TTo>, bridge: FxBridge<TFrom, TTo>)(Capital<TTo>, FxAuditReceipt)Consumes source into bridge's TFrom clearing leg and sources balanced Capital<TTo> from bridge's TTo leg.

audit.* — Z-SOX-302 Deterministic Attestation

Function SignatureReturn TypeDescription
audit.trialBalance(ledger: Ledger)TrialBalanceSnapshotComputes immutable period totals and asserts Assets + Expenses ≡ Liabilities + Equity + Revenue per currency.
audit.attestZsox302(ledger: Ledger, periodId: String)ZsoxAttestationEmits SHA-256 hash-chained journal digest inspired by Zoë Wren Brooks's Z-SOX-302 governance protocol in The Eleventh Child.
audit.attach(receipt: AuditArtifact)UnitAttaches structured FX, invoice, or external bank-feed evidence metadata to the enclosing transaction journal record.

report.* — Accessible Financial Statements

Function SignatureReturn TypeDescription
report.exportTaggedPdfUa(snapshot: TrialBalanceSnapshot, outputPath: String)ReportResultExports an ISO 14289-1 Tagged PDF/UA-1 accessible trial balance and income statement compatible with screen readers and RaggieSoft Document Studio.
report.exportCsv(snapshot: TrialBalanceSnapshot, outputPath: String)ReportResultExports RFC 4180 UTF-8 CSV ledger schedules with exact fixed-point decimal strings.

Compiler Pipeline Architecture ("Mini-Roslyn" on .NET)

Why build FinSharp.Compiler as a standalone immutable C# syntax tree lowering to Roslyn rather than forking all 4+ million lines of dotnet/roslyn?

  1. Sub-3-Second Cold Builds: Developers and contributors can clone, read, and compile the entire Fin# toolchain in seconds without a 30 GB compiler build environment.
  2. 100-Level Read-Along Clarity: Every pass—FinLexer -> FinParser -> FinBinder -> LinearFlowAnalyzer -> CSharpRoslynEmitter—fits cleanly in well-commented C# files.
  3. Full .NET & Studio Ecosystem Integration: Emits standard signed .NET IL + PDBs and powers a candidate RaggieSoft Fin# / Ledger Studio workstation (WebView2 + Monaco + Live T-Account Visualizer, honoring Community == 100% Architect Feature Parity!).
Indexed API Calls & Symbols on This Page (14):