Gravity.Dsl.Ast 0.7.0

dotnet add package Gravity.Dsl.Ast --version 0.7.0
                    
NuGet\Install-Package Gravity.Dsl.Ast -Version 0.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Gravity.Dsl.Ast" Version="0.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Gravity.Dsl.Ast" Version="0.7.0" />
                    
Directory.Packages.props
<PackageReference Include="Gravity.Dsl.Ast" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Gravity.Dsl.Ast --version 0.7.0
                    
#r "nuget: Gravity.Dsl.Ast, 0.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Gravity.Dsl.Ast@0.7.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Gravity.Dsl.Ast&version=0.7.0
                    
Install as a Cake Addin
#tool nuget:?package=Gravity.Dsl.Ast&version=0.7.0
                    
Install as a Cake Tool

Gravity.Dsl.Ast

Public, versioned AST records for the Gravity DSL — a textual definition language for AI-constrained enterprise software development.

This is the read-only contract emitters consume. The Gravity compiler parses, resolves, and validates .gravity source, then publishes an instance of these records to any registered emitter through the Gravity.Dsl.Emitter host. Emitters do not depend on the compiler; they depend on this package and on Gravity.Dsl.Emitter.

AST version contract

The package exposes a single constant:

public static class AstVersion
{
    public const string Value = "1.1.0";
}

AstVersion is independent of the DSL grammar version. The grammar can grow additively without changing the AST version; only a breaking change to a public record on this package bumps the major.

1.1.0 (Phase 8)

Single additive change: NamedTypeRef gains an optional int? Version slot, appended as the last positional parameter with a default of null. The 4-argument constructor signature from 1.0.0 is preserved — source compiled against 1.0.0 that constructed new NamedTypeRef(name, isOpt, isArr, span) continues to compile and run identically against 1.1.0 (the default kicks in, Version = null). Pattern matching using named properties (is NamedTypeRef n then reading n.Name, n.IsOptional, etc.) is unaffected. Per the FR-111 compatibility promise, no other AST record changes shape. See specs/002-phase-8-versioning/ (FR-110, FR-111, FR-112, FR-113) for the versioning surface.

Emitters declare the AST version range they support (see Gravity.Dsl.Emitter.IEmitter.SupportedAstVersions). The emitter host refuses incompatible emitters with a clear error at startup. This is how the Gravity project keeps third-party emitters working across grammar revisions.

Additive-only versioning policy (AST level)

  • A new optional field on an existing record is non-breaking if it has a default that preserves the prior semantics. Such a change is shipped in a minor version of this package and does not bump AstVersion's major.
  • A new record type is non-breaking and ships in a minor version.
  • Removing a field, narrowing a field's type, or changing a record's shape in a way that existing emitters cannot tolerate is breaking and requires:
    1. A major bump of AstVersion.Value.
    2. A documented migration path for third-party emitters.
    3. A deprecation window in which both AST versions are published in parallel.

This policy mirrors the DSL's own additive-only-by-default principle (constitution Principle IV) at the AST contract level.

Read-only contract (Principle III, VI)

Every record is a C# record with init-only properties; every collection is an ImmutableArray<T> or ImmutableSortedDictionary<TKey, TValue>. There is no API on this package that lets downstream code redefine domain meaning at build time — that is the central governance mechanism of the Gravity DSL.

In particular, AnnotationDecl.Arguments uses ImmutableSortedDictionary (not ImmutableDictionary) so iteration order is byte-stable across runs and platforms. This is required for deterministic emitter output and is part of the contract.

Compatibility

  • Target framework: net9.0.
  • No external dependencies beyond System.Collections.Immutable (BCL).

License

Apache-2.0. See LICENSE in the repository root.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Gravity.Dsl.Ast:

Package Downloads
Gravity.Dsl.Compiler

Gravity DSL compiler core — lexing, parsing, resolution, validation, and AST construction over the Pidgin parser combinator stack.

Gravity.Dsl.Emitter

IEmitter contract and emitter host for the Gravity DSL.

Gravity.Dsl.Emitter.CSharp

C# reference emitter for the Gravity DSL.

Gravity.Dsl.Emitter.JsonSchema

JSON Schema (Draft-07) reference emitter for the Gravity DSL — emits per-entity bundles, per-value-type, and per-enum schemas.

Gravity.Dsl.Emitter.PostgresDdl

PostgreSQL DDL reference emitter for the Gravity DSL — emits idempotent table creation SQL plus per-version migration ledgers; target schema configurable.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.0 379 6/26/2026
0.6.0 218 6/26/2026
0.5.0 194 6/26/2026
0.4.0 195 6/26/2026
0.3.0 184 6/16/2026
0.2.0 228 6/16/2026
0.1.0-alpha4 175 5/19/2026
0.1.0-alpha2 140 5/19/2026