parsi icon indicating copy to clipboard operation
parsi copied to clipboard

add c api

Open cthulhu-irl opened this issue 5 months ago • 0 comments

Description

The library is heavily template-based and leverages compile-time zero-runtime-cost abstractions, which are specific to C++ and can not export bindings based on those for other languages.

Most bindings are based on C (ABI), and are runtime-based/bound. For this reason, a C API is required to be established first, then bindings and libraries to be provided for other languages like Python.

Suggestion: There are so many types of parsers and combinators which can easily result in lots of allocations (to wrap into a dynamic polymorphic type like RTParser) and hard to manage/use as a C API. It is suggested to design the API in a way where the configuration is easy to make, and the function APIs are as little as possible, unlike current C++ API. This can also help with optimization in implementation to have less runtime indirections.

Goals

  • Cover more users and use-cases, specially performance for languages that are inherently slow (e.g. Python).

Definition of Done

  • The C API must cover all core parsers and combinators.

cthulhu-irl avatar Sep 03 '24 21:09 cthulhu-irl