Esolang.Processor.Abstractions
2.0.2
dotnet add package Esolang.Processor.Abstractions --version 2.0.2
NuGet\Install-Package Esolang.Processor.Abstractions -Version 2.0.2
<PackageReference Include="Esolang.Processor.Abstractions" Version="2.0.2" />
<PackageVersion Include="Esolang.Processor.Abstractions" Version="2.0.2" />
<PackageReference Include="Esolang.Processor.Abstractions" />
paket add Esolang.Processor.Abstractions --version 2.0.2
#r "nuget: Esolang.Processor.Abstractions, 2.0.2"
#:package Esolang.Processor.Abstractions@2.0.2
#addin nuget:?package=Esolang.Processor.Abstractions&version=2.0.2
#tool nuget:?package=Esolang.Processor.Abstractions&version=2.0.2
Esolang.Processor.Abstractions
Unified processor abstractions for esolang execution across the Esolang.NET ecosystem.
Installation
dotnet add package Esolang.Processor.Abstractions
Overview
This package provides common interfaces and extension methods for implementing esolang processors (interpreters) based on an event-driven I/O model.
Core Interfaces
IProcessor<TProgram>
Base interface that holds a parsed program.
public interface IProcessor<TProgram> : IProcessor
{
/// <summary>The parsed program.</summary>
TProgram Program { get; }
}
IEventProcessor
Execution interface based on a stream of I/O events.
public interface IEventProcessor : IProcessor
{
/// <summary>
/// Executes the processor and returns an asynchronous stream of I/O events.
/// </summary>
IAsyncEnumerable<IOEvent> RunAsyncEnumerable(CancellationToken cancellationToken = default);
}
IO Events
The IEventProcessor communicates with the outside world through a stream of IOEvent objects.
| Event Type | Purpose | Factory Method |
|---|---|---|
InputCharEvent |
Requests a single character from the input. | IOEvent.InputChar(Action<char> write) |
InputIntEvent |
Requests a single integer from the input. | IOEvent.InputInt(Action<int> write) |
OutputCharEvent |
Sends a single character to the output. | IOEvent.OutputChar(char output) |
OutputIntEvent |
Sends a single integer to the output. | IOEvent.OutputInt(int output) |
EndEvent |
Signals the end of execution and provides an exit code. | IOEvent.End(int exitCode) |
Extension Methods
To facilitate running processors, common extension methods are provided in separate packages:
Esolang.Processor.Extensions.IO: ContainsTextProcessorExtensions(forTextReader/TextWriter),StringProcessorExtensions(forstring/StringBuilder), andPipeProcessorExtensions(forPipeReader/PipeWriter).
// Example using TextReader/TextWriter
await processor.RunToEndAsync(inputReader, outputWriter, cancellationToken);
// Example using PipeReader/PipeWriter
await processor.RunToEndAsync(inputPipe, outputPipe, cancellationToken);
// Example using string input/output
var result = await processor.RunToStringAsync(input: "your_input", cancellationToken);
Usage Example
Implement IEventProcessor in your processor:
using Esolang.Processor;
public class MyEsolangProcessor : IEventProcessor
{
public MyProgram Program { get; }
public async IAsyncEnumerable<IOEvent> RunAsyncEnumerable(CancellationToken cancellationToken = default)
{
// Implement the execution logic yielding IOEvents
yield return IOEvent.OutputChar('H');
yield return IOEvent.OutputChar('i');
yield return IOEvent.End(0);
}
}
Target Framework
- netstandard2.0 — Compatible with .NET Framework 4.6.1+ and .NET Core 2.0+
- netstandard2.1 — Compatible with .NET Core 3.0+ and .NET 5+
See Also
- Esolang.Funge — Funge-98 implementation
- Esolang.Brainfuck — Brainfuck implementation
- Esolang.Piet — Piet implementation
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 is compatible. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 1.1.1)
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Esolang.Processor.Abstractions:
| Package | Downloads |
|---|---|
|
Esolang.Brainfuck.Processor
Package Description |
|
|
Esolang.Interpreter.Abstractions
Common abstraction interfaces for implementing esolang interpreters, facilitating integration with the unified processor model. |
|
|
Esolang.Piet.Processor
Execution engine for Piet programs. |
|
|
Esolang.Funge.Processor
Execution engine for Funge-98 programs. |
|
|
Esolang.Processor.Extensions.IO
Comprehensive I/O extension methods for IEventProcessor, supporting TextReader/Writer, System.IO.Pipelines, and string-based execution. |
GitHub repositories
This package is not used by any popular GitHub repositories.