TinyAst 0.11.2
dotnet add package TinyAst --version 0.11.2
NuGet\Install-Package TinyAst -Version 0.11.2
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="TinyAst" Version="0.11.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TinyAst" Version="0.11.2" />
<PackageReference Include="TinyAst" />
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 TinyAst --version 0.11.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TinyAst, 0.11.2"
#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 TinyAst@0.11.2
#: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=TinyAst&version=0.11.2
#tool nuget:?package=TinyAst&version=0.11.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TinyTokenizer
A high-performance syntax tree library for .NET 8+ with fluent queries, pattern matching, and undo/redo editing — built on a zero-allocation tokenizer with SIMD optimization.
Features
- TinyAst — Red-green syntax tree with fluent queries, editing, and undo/redo
- Query API — CSS-like selectors with combinators, lookahead, and repetition
- SyntaxEditor — Batch mutations with atomic commit and full undo/redo support
- Syntax Nodes — Pattern-based AST matching (function calls, property access, etc.)
- Schema System — Unified configuration for tokenization + syntax node definitions
- TreeWalker — DOM-style filtered tree traversal
- High Performance — Zero-allocation parsing with SIMD-optimized
SearchValues<char> - Error Recovery — Gracefully handles malformed input and continues parsing
Installation
dotnet add package TinyAst
Quick Start
TinyAst
using TinyTokenizer.Ast;
// Parse source into a syntax tree
var tree = SyntaxTree.Parse("function foo() { return 1; }");
// Query nodes with CSS-like selectors
var idents = tree.Select(Query.AnyIdent); // [Ident("function"), Ident("foo"), Ident("return")]
// Fluent mutations with undo support
tree.CreateEditor()
.Replace(Query.Ident("foo"), "bar")
.Insert(Query.BraceBlock.First().InnerStart(), "console.log('enter');")
.Commit();
// Undo/redo
tree.Undo();
tree.Redo();
Pattern Matching with Schema
var tree = SyntaxTree.Parse("obj.method(x)", Schema.Default);
var methodCalls = tree.Match<MethodCallSyntax>().ToList(); // [MethodCallSyntax { Object="obj", Method="method" }]
Low-Level Tokenization
For scenarios where you don't need a syntax tree:
using TinyTokenizer;
var tokens = "func(a, b)".TokenizeToTokens();
// tokens contains:
// - IdentToken("func")
// - BlockToken("(a, b)") with children:
// - IdentToken("a"), SymbolToken(","), WhitespaceToken(" "), IdentToken("b")
📚 Documentation
Full documentation on the Wiki →
TinyAst
| Topic | Description |
|---|---|
| TinyAst Guide | Syntax tree API |
| Schema | Unified configuration |
| Query API | CSS-like node selectors |
| SyntaxEditor | Batch mutations, undo/redo |
| Syntax Nodes | Pattern-based matching |
| TreeWalker | DOM-style traversal |
| Trivia | Whitespace preservation |
Low-Level Tokenization
| Topic | Description |
|---|---|
| Token Types | SimpleToken vs Token, all types |
| Configuration | Operators, comments, symbols |
| Async Streaming | Stream/PipeReader APIs |
| Error Handling | ErrorToken and recovery |
Reference
| Topic | Description |
|---|---|
| Getting Started | Installation and basic usage |
| Architecture | Two-level design, red-green trees |
| API Reference | Types, enums, methods |
Requirements
- .NET 8.0 or later
CommunityToolkit.HighPerformance(automatically included)
License
MIT
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- CommunityToolkit.HighPerformance (>= 8.2.2)
- System.IO.Pipelines (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TinyAst:
| Package | Downloads |
|---|---|
|
TinyAst.Preprocessor
AST-native preprocessor bridge between TinyAst and TinyPreprocessor. Enables import/include preprocessing directly on schema-bound syntax trees without text reparsing. |
GitHub repositories
This package is not used by any popular GitHub repositories.