Skip to content

Atloria.CSharpParser

reference
1 min readUpdated

Kind: Module

Source: atloria-monorepo/libs/parser-core/src/dotnet-bridge/Atloria.CSharpParser/Atloria.CSharpParser.csproj

.NET project in solution

Atloria.CSharpParser is the .NET bridge project responsible for parsing C# source code using the .NET/Roslyn toolchain. It is invoked by the parser-core integration layer to convert C# files into structured data that can be consumed by the Atloria TypeScript/JavaScript tooling.

Diagram

mermaid
graph TD
  A[TypeScript / JavaScript caller] --> B[parser-core]
  B --> C[Atloria.CSharpParser .NET bridge]
  C --> D[Roslyn C# parser]
  D --> E[Structured syntax / symbol data]
  E --> B
  B --> F[Atloria analysis and indexing features]

Usage

ts
import { parseSourceFile } from "@atloria/parser-core";

const source = `
namespace Demo;

public class GreetingService
{
    public string SayHello(string name) => $"Hello, {name}";
}
`;

const result = await parseSourceFile({
  language: "csharp",
  filePath: "GreetingService.cs",
  content: source,
});

console.log(result);
// Use the returned declarations, methods, references, and syntax metadata
// in downstream indexing or analysis workflows.

AI Coding Instructions

  • Keep the bridge contract stable: any changes to .NET output models must be reflected in the TypeScript parser-core consumer.
  • Use Roslyn APIs for C# syntax and semantic analysis rather than implementing custom text-based parsing.
  • Preserve source locations, file paths, and declaration identities in parser output so downstream analysis can map results back to source files.
  • Ensure the project can be built and executed in the environments used by the Node.js integration layer; avoid machine-specific paths or SDK assumptions.
  • When adding supported C# constructs, include representative fixture files and verify the serialized bridge output remains backward compatible.

Relationships

  • DEPENDS_ON → Microsoft.CodeAnalysis.CSharp
  • DEPENDS_ON → System.Text.Json

Referenced By

  • atloria (MODULE_DECLARES)

Was this page helpful?

Download as PDF