APERTURESyndicate.Synx
3.6.2
dotnet add package APERTURESyndicate.Synx --version 3.6.2
NuGet\Install-Package APERTURESyndicate.Synx -Version 3.6.2
<PackageReference Include="APERTURESyndicate.Synx" Version="3.6.2" />
<PackageVersion Include="APERTURESyndicate.Synx" Version="3.6.2" />
<PackageReference Include="APERTURESyndicate.Synx" />
paket add APERTURESyndicate.Synx --version 3.6.2
#r "nuget: APERTURESyndicate.Synx, 3.6.2"
#:package APERTURESyndicate.Synx@3.6.2
#addin nuget:?package=APERTURESyndicate.Synx&version=3.6.2
#tool nuget:?package=APERTURESyndicate.Synx&version=3.6.2
Main SYNX site: https://synx.aperturesyndicate.com/
SYNX for .NET
C# parser and JSON emitter aligned with synx-core: same tree rules as parser::parse, deterministic JSON as to_json (sorted object keys, matching escapes and float formatting via Utf8JsonWriter).
Quick start (new project)
- Install .NET 8 SDK.
- Create a console app and add the package:
dotnet new console -n MySynxApp -f net8.0
cd MySynxApp
dotnet add package APERTURESyndicate.Synx
- Replace
Program.cs:
using Synx;
var text = """
server
host 127.0.0.1
port 8080
""";
// Static parse only (no !active — :env / :calc are NOT executed)
var data = SynxFormat.Parse(text);
Console.WriteLine(SynxFormat.ToJson(data));
// With !active — markers resolve (:env, :calc, includes, etc.)
var activeText = """
!active
port:env:default:7777 PORT
""";
var env = new Dictionary<string, string>(StringComparer.Ordinal) { ["PORT"] = "3000" };
var resolved = SynxFormat.ParseActive(activeText, new SynxOptions { Env = env });
Console.WriteLine(SynxFormat.ToJson(resolved));
- Run:
dotnet run
Package name: APERTURESyndicate.Synx (not Synx.Core — that ID is taken on nuget.org). Namespace: Synx. Types: SynxFormat (entry points), SynxValue (tree: SynxValue.Obj, .Str, .Int, …).
If the package is not on nuget.org yet: clone this repo, then either:
dotnet add reference /absolute/path/to/synx-format/parsers/dotnet/src/Synx.Core/Synx.Core.csproj
or build a local package from repo root: .\publish-csharp.bat (without NUGET_API_KEY it only packs), then:
dotnet add package APERTURESyndicate.Synx --source /absolute/path/to/synx-format/artifacts/nuget
Requirements
- .NET SDK 8.0 or later (for local development you can bump
<TargetFramework>in the.csprojfiles if you only have a newer runtime).
Layout
| Path | Purpose |
|---|---|
Synx.sln |
Solution |
src/Synx.Core/ |
Library: SynxFormat.Parse, SynxFormat.ParseTool, SynxFormat.ToJson, SynxValue |
tests/Synx.Core.Tests/ |
xUnit — runs repo root tests/conformance/cases/*.synx + .expected.json (same as Rust synx-core conformance test) |
tools/Synx.FuzzReplay/ |
Console tool: replay arbitrary files through Parse + ToJson (strict UTF-8 only — matches Rust fuzz_parse filter). Use alongside crates/synx-core/fuzz/ artifacts. |
Commands
cd parsers/dotnet
dotnet test
dotnet build -c Release
# Replay fuzz corpora / minimized inputs on the C# parser (must be valid UTF-8)
dotnet run -c Release --project tools/Synx.FuzzReplay -- path/to/fuzz/artifacts/fuzz_parse/minimized-from-*
# Optional timing (parse + ToJson per file)
dotnet run -c Release --project tools/Synx.FuzzReplay -- --bench tests/conformance/cases/*.synx
API (preview)
SynxFormat.Parse(string)— static parse →Dictionary<string, SynxValue>(no!activeengine: markers are not resolved).SynxFormat.ParseActive(string, SynxOptions?)— parse + resolve (:calc,:env,:ref,:alias, constraints, includes, interpolation, …) — targets parity withsynx-core::engine::resolve.SynxFormat.ParseFull/ParseFullActive— fullSynxParseResultincludingMetadataandIncludes.SynxFormat.ParseTool(string)— parse +reshape_tool_output(matches Rust when the file is not!active).SynxFormat.ToJson— canonical JSON string for a value or root map.SynxFormat.Deserialize<T>(string, JsonSerializerOptions?)— parse then deserialize directly intoTviaSystem.Text.Json. ReplacesJsonSerializer.Deserialize<T>(SynxFormat.ToJson(SynxFormat.Parse(text))).SynxFormat.DeserializeActive<T>(string, SynxOptions?, JsonSerializerOptions?)— parse + engine resolve then deserialize intoT.
SynxValue helpers
SynxValue provides accessor methods mirroring Rust's Value::as_*():
var data = SynxFormat.Parse("name Alice\nage 30\nactive true");
// Indexer access (returns SynxValue.Null if missing)
SynxValue name = data["name"];
// Type-safe unwrapping (returns null if wrong type)
string? s = data["name"].AsString(); // "Alice"
long? n = data["age"].AsInt(); // 30
double? f = data["age"].AsFloat(); // 30.0
bool? b = data["active"].AsBool(); // true
bool isNul = data["missing"].IsNull(); // true
// Nested access via indexers
var port = data["server"]["port"].AsInt();
// ToString() for display
Console.WriteLine(data["name"]); // Alice
Console.WriteLine(data["age"]); // 30
Consume from NuGet (after publish)
Package ID: APERTURESyndicate.Synx (the ID Synx.Core is already used by another package on nuget.org). Project folder in this repo remains Synx.Core; namespaces are Synx.
dotnet add package APERTURESyndicate.Synx
Prerelease / local build: add a project reference into your solution, or pack a feed:
# from repo root — produces artifacts/nuget/APERTURESyndicate.Synx.*.nupkg (push optional)
.\publish-csharp.bat
dotnet add package APERTURESyndicate.Synx --source /absolute/path/to/synx-format/artifacts/nuget
Publish to nuget.org (maintainers)
- Bump
Versioninsrc/Synx.Core/Synx.Core.csproj. - Create an API key whose glob includes
APERTURESyndicate.Synxor*. - PowerShell:
$env:NUGET_API_KEY = '…token only…'— do not wrap the key in<>. - Repo root:
.\publish-csharp.bat(clears old*.nupkginartifacts/nuget, pushes onlyAPERTURESyndicate.Synx.*.nupkg).
Next: .synxb, diff in C#; broaden engine parity tests beyond smoke cases.
Tests: library targets .NET 8; test project and Synx.FuzzReplay may target .NET 10 on machines where only a newer runtime is installed — adjust <TargetFramework> in the respective .csproj files if dotnet run fails with a framework error.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Wasmtime (>= 34.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.