Malib 0.1.0-preview.14
dotnet add package Malib --version 0.1.0-preview.14
NuGet\Install-Package Malib -Version 0.1.0-preview.14
<PackageReference Include="Malib" Version="0.1.0-preview.14" />
<PackageVersion Include="Malib" Version="0.1.0-preview.14" />
<PackageReference Include="Malib" />
paket add Malib --version 0.1.0-preview.14
#r "nuget: Malib, 0.1.0-preview.14"
#:package Malib@0.1.0-preview.14
#addin nuget:?package=Malib&version=0.1.0-preview.14&prerelease
#tool nuget:?package=Malib&version=0.1.0-preview.14&prerelease
Malib .NET Binding
Malib is an embeddable text analysis and transformation engine inspired by Matla. This package exposes a .NET API over the native Malib runtime.
Install
dotnet add package Malib
The NuGet package bundles the native matlalib_ffi and compatible FastParse
runtimes under runtimes/*/native for supported platforms. Grammar-aware
when ast rules work without installing a second package. During local
development without packed native assets, set:
export MALIB_NATIVE_LIBRARY_PATH=/path/to/libmatlalib_ffi.dylib
You can also call MalibNative.ConfigureLibraryPath(...) before the first
Malib call.
Malib Language Documentation
The package includes the version-matched Malib language documentation under:
docs/malib/
AI agents should open docs/malib/package-bootstrap.json first when working
from an installed package. It uses schema malib.package.bootstrap.v1 and
points to the shortest path through docs/malib/AI-AGENT-GUIDE.md,
docs/malib/language-metadata.json, workflow guides, schema contracts,
agent evals, and release verification commands.
.NET hosts can locate that file with:
var bootstrapPath = MalibDocumentation.GetRequiredPackageBootstrapPath();
var bootstrapJson = MalibDocumentation.ReadRequiredPackageBootstrapJson();
var evalManifest = MalibDocumentation.ReadRequiredDocsText("agent-evals/manifest.json");
var contractEvidence = MalibDocumentation.ReadRequiredContractEvidenceSummary();
Console.WriteLine(contractEvidence.Summary.DocumentedOnly);
Console.WriteLine(contractEvidence.Gaps.GoldenWithoutFixture.Count);
The package root also includes CHANGELOG.md with the version-by-version
release history.
Malib release and smoke workflows verify this documentation bundle against
docs/malib/language-metadata.json, including package bootstrap, schemas,
fixtures, and agent evals, before publishing.
The NuGet smoke programs also validate packaged trace, coverage, and final run
report APIs against malib.trace.event.v1, malib.coverage.v2, and
malib.run.report.v1 evidence.
Minimal Example
using Malib;
using var program = MalibProgram.Compile("""
debug on all
coverage on
let found = 0
when ("IF") {
found = 1
}
export { found: found }
""");
var result = program.RunText(
"IF A\n",
new MalibRunOptions
{
SourceName = "memory.cbl",
Profile = true,
Trace = true,
Coverage = true,
Report = true
});
Console.WriteLine(result.Variables["found"].AsString());
Console.WriteLine(result.Profile?.RuleMatches);
Console.WriteLine(result.Trace.Count);
Console.WriteLine(result.Coverage?.Totals?.Matched);
Console.WriteLine(result.Coverage?.Rules[0].Rule);
Console.WriteLine(result.Coverage?.TokenStates[0].CausedBy[0].Action);
Console.WriteLine(result.Report?.Schema);
Console.WriteLine(result.Report?.RuntimeEffects.GetRawText());
Contract
MalibProgramowns a native compiled program handle and must be disposed.MalibProgram.Compile(string)compiles Malib source from memory.MalibProgram.CompileFile(path)compiles a.malibfile and resolves relativeimport ruleset,import analyzer, andimport funmodules from that file's directory.MalibProgram.CompileProject(path)compiles a project directory by resolvingsrc/main.malibfirst, thenmain.malib. Use this for modern modular Malib projects withsrc/rulesets,src/analyzers, andsrc/funmodules.RunTextandRunBytesrun source content from memory; the parent application owns source, stream, and general application IO.- Physical SQLite and SQLite RAM functions inside Malib programs are enabled by
the bundled native runtime:
sqlite_query,sqlite_execute,sqlite_insert_many,sqlite_ram_query,sqlite_ram_execute,sqlite_ram_insert_many, and the RAM-backedtable_*helpers. Physical functions operate on database file paths visible to the native process. grammar "java"andwhen astuse the bundled FastParse provider lazily. Grammar declarations have zero AST parse cost until a structural rule runs. Optional language extensions are discovered by canonical grammar name from the packaged native directory orFASTPARSE_GRAMMAR_PATH.MalibResultexposes prints, flags, variables, export data, token count, optional profile metrics, optional structured trace events, optional coverage audit data, and optionalmalib.run.report.v1final run reports.Trace = truereturns debug events enabled by Malib source such asdebug on all; it does not enable debug by itself.when_matchandwhen_no_matchtrace events exposeMalibTraceEvent.GroupandMalibTraceEvent.Rule; all trace events include common JSON fields such aseffect_type,subject,rule_attributed, andattributionfor agent-friendly triage.Coverage = truereturnscoverage ontoken audit data with schemamalib.coverage.v2, totals, per-rule aggregates, per-token states, and per-tokenCausedByevidence; it does not enable coverage by itself.Report = truereturns a compact AI-friendly final run report withmalib.runtime.effects.v1logical effect summaries, including per-ruleby_rule,by_variable,by_flag, andby_source_operationattribution, and enables profile collection for that run.MalibValuewraps structured Malib values as JSON-backed text, list, and object accessors.- Native pointers are not exposed through the public .NET API.
MalibDocumentation.ReadRequiredContractEvidenceSummary()reads the package-versionedmalib.contract.evidence.v1snapshot as a typed object for Matla/Malib compatibility evidence. UseFindEntry("MCM-0160")to inspect a specific mapping. UseGaps.DocumentedOnly,Gaps.GoldenWithoutFixture, andGaps.FixtureWithoutGoldento prioritize new fixtures and golden runs.
Threading
A compiled MalibProgram is intended to be reusable across executions. Do not
dispose a program while another thread is running it. Until dedicated concurrent
binding tests are added, prefer one MalibProgram per worker for production
parallelism.
Errors
Native compile and runtime failures are surfaced as MalibException. Inspect
MalibException.StructuredDiagnostic first: parser/compiler failures use
malib.language.diagnostic.v1 with stable M#### code, category, optional
source span, help text, and docs anchor. Runtime failures may also include the
compatibility accessor MalibException.Diagnostic, a JSON-backed
malib.runtime.diagnostic.v1 object with stable MR#### code, category,
message, suggestion, and docs anchor.
try
{
program.RunText("IF A\n");
}
catch (MalibException ex) when (ex.Diagnostic is not null)
{
Console.WriteLine($"{ex.Diagnostic.Code}: {ex.Diagnostic.Suggestion}");
}
try
{
MalibProgram.Compile("when (\"IF\") {\n nope\n}\n");
}
catch (MalibException ex) when (ex.StructuredDiagnostic is not null)
{
Console.WriteLine($"{ex.StructuredDiagnostic.Code}: {ex.StructuredDiagnostic.Help}");
}
| 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 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. |
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.14 | 38 | 9/17/2026 |
| 0.1.0-preview.13 | 60 | 9/11/2026 |
| 0.1.0-preview.9 | 86 | 7/3/2026 |
| 0.1.0-preview.8 | 79 | 7/2/2026 |
| 0.1.0-preview.7 | 76 | 7/1/2026 |
| 0.1.0-preview.6 | 83 | 6/30/2026 |
| 0.1.0-preview.5 | 72 | 6/30/2026 |
| 0.1.0-preview.4 | 66 | 6/30/2026 |
| 0.1.0-preview.3 | 64 | 6/30/2026 |
| 0.1.0-preview.2 | 60 | 6/30/2026 |
| 0.1.0-preview.1 | 64 | 6/30/2026 |
Adds FastParse-backed structural analysis with shared scopes, bidirectional and sibling navigation, rule alternatives, parser-quality filters, non-destructive consume and residual audits; completes structured data CRUD and bundles expanded AI-agent documentation.