kharp - k version 3 Language Interpreter in C#
Deploy ksharp to run K language scripts on .NET platforms and leverage its FFI for .NET integration.
Integrate ksharp into your .NET workflow and run sample K scripts to validate FFI functionality.
Summary
ksharp is a comprehensive implementation of the K programming language, version 3, written in C#. The beta release fully implements core data types, native operators, and the adverb system, including over, scan, each, and others. It introduces a Foreign Function Interface (FFI) that allows .NET objects to be used directly within K scripts, along with a hint system (_gethint, _sethint) and object instantiation via _dotnet. The interpreter supports error handling, performance considerations, and a test suite that passes 1549 tests (100% success). Additional features include support for delimited file I/O, comparison tolerance updates, and adnoun support for scatter indexing.
The architecture follows a simple Tokenize‑Parse‑Evaluate pipeline, avoiding complex stacks or finite state machines. While performance is not on par with native K implementations, the .NET VM offers benefits such as garbage collection and a rich ecosystem. The project also includes build scripts for Windows, Linux, and macOS, enabling cross‑platform usage.
ksharp aims to provide a fully compatible K interpreter for .NET developers, enabling integration with existing .NET workflows and leveraging the power of K for data manipulation and analysis.
Key changes
- Fully implements core data types and native operators
- Adds adverb system with over, scan, each, etc.
- Provides Foreign Function Interface for .NET objects
- Includes hint system with _gethint and _sethint
- Supports object instantiation and disposal via _dotnet
- Adds error handling and performance considerations
- Test suite passes 100% with 1549 tests
- Adds support for delimited file I/O and comparison tolerance