{"id":51778207,"url":"https://github.com/puffball1567/nifkit","last_synced_at":"2026-07-20T08:03:39.186Z","repository":{"id":371053471,"uuid":"1298067210","full_name":"puffball1567/nifkit","owner":"puffball1567","description":"Spec-based NIF/BIF toolkit for Nim and C ABI consumers","archived":false,"fork":false,"pushed_at":"2026-07-13T01:42:01.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-13T03:15:00.611Z","etag":null,"topics":["bif","binary-format","c-abi","codec","ffi","mit-license","nif","nim","parser","serialization"],"latest_commit_sha":null,"homepage":null,"language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puffball1567.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-07-12T07:15:00.000Z","updated_at":"2026-07-13T01:41:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/puffball1567/nifkit","commit_stats":null,"previous_names":["puffball1567/nifkit"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/puffball1567/nifkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puffball1567%2Fnifkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puffball1567%2Fnifkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puffball1567%2Fnifkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puffball1567%2Fnifkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puffball1567","download_url":"https://codeload.github.com/puffball1567/nifkit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puffball1567%2Fnifkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35678471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"ssl_error","status_checked_at":"2026-07-20T02:08:09.736Z","response_time":111,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bif","binary-format","c-abi","codec","ffi","mit-license","nif","nim","parser","serialization"],"created_at":"2026-07-20T08:03:38.703Z","updated_at":"2026-07-20T08:03:39.180Z","avatar_url":"https://github.com/puffball1567.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nifkit\n\n`nifkit` is a spec-based NIF/BIF toolkit for making NIF usable from multiple\nprogramming languages. It provides a Nim API and a stable C ABI for converting,\nvalidating, and inspecting NIF text and BIF binary payloads.\n\n## Scope\n\n- `nifToBif`: NIF text to BIF bytes\n- `bifToNif`: BIF bytes to canonical NIF text\n- `validateBif`: BIF validation without semantic interpretation\n- C ABI for `NIF text -\u003e BIF bytes`, `BIF bytes -\u003e NIF text`, and BIF\n  validation\n\n`nifkit` is intentionally a library, not a standalone user-facing CLI. It is\ndesigned to be embedded by databases, drivers, adapters, language bindings, and\nother tools that need NIF/BIF support.\n\n## Install\n\nFrom a local checkout:\n\n```sh\nnimble install\n```\n\nFrom a Git repository:\n\n```sh\nnimble install https://github.com/\u003cowner\u003e/nifkit\n```\n\nAfter the package is accepted into the Nimble package list, it can be installed\nwith:\n\n```sh\nnimble install nifkit\n```\n\n## Format Boundary\n\nThe codec backend is implemented against the public NIF/BIF specification. The\nspecification is the compatibility contract: this package has no dependency on\nNimony or any compiler implementation. This keeps the public API stable if an\nofficial standalone NIF/BIF library becomes available later: the internal\nbackend can be replaced without changing callers.\n\nThe target format is NIF 2027 text and BIF v5 binary data. The codec preserves\nthe semantic AST shape and renders decoded data as canonical NIF text. It\nsupports suffix comments, base62 line information, escaped identifiers and\nsymbols, identifier/symbol/tag grammar checks, directives, pooled\nstrings/symbols/tags, global symbol indexes, and malformed BIF rejection.\nStandalone comments are rejected because NIF 2027 comments are suffix metadata,\nnot free-floating syntax nodes. Raw NIF control characters inside strings,\ncharacter literals, suffix comments, and line-info metadata are rejected unless\nthey are written with NIF escapes.\n\nBIF decoding renders token-kind-aware canonical NIF. For example, a BIF\nidentifier containing `.` is printed with an escaped dot so that it remains an\nidentifier when parsed again, rather than accidentally becoming a symbol.\n\n`nifkit` is not a NIF interpreter, compiler frontend/backend, VM, optimizer, or\ndialect normalizer. It does not decide whether callers should use `.s.nif`,\n`lengc`, or any other compiler-stage dialect. Applications must choose the\ncorrect NIF dialect or compiler stage for their semantic use case.\n\nRocheDB can use nifkit for NIF/BIF payload conversion, but nifkit itself is\ngeneral-purpose and does not know about RocheDB rings, placement, or storage\nmetadata.\n\n## Acknowledgements\n\n`nifkit` exists because Araq and the Nimony/NIF contributors defined and\ndocumented the NIF/BIF foundation. This project is an independent compatibility\nlibrary built on that public specification, with thanks to their work.\n\n## Development\n\n```sh\nnimble test\nnimble matrixDemo\nnimble cabiContract\nnimble verify\n```\n\n`nimble matrixDemo` runs representative NIF shapes through the codec:\ndirectives, comments, escaped strings, symbols, nested tags, and line-info.\n\nClang is the recommended C ABI verification compiler. GCC is also supported for\nLinux compatibility; replace `clang` with `gcc` in the contract build command.\n\nThe package is built with Nim ARC via `config.nims`. Codec internals use Nim\nowned `string`, `seq`, and `Table` values; the C ABI copies input bytes into ARC\nmanaged memory and returns explicit output buffers that must be released with\n`nifkit_free`.\n\nUse nifkit from Nim:\n\n```nim\nimport nifkit\n\nlet bif = nifToBif(\"(record title \\\"NIF\\\")\")\nlet nif = bifToNif(bif)\nvalidateBif(bif)\n```\n\nApplications should call the Nim API or C ABI directly. Applications may store\nBIF however they want; semantic interpretation belongs to the embedding\napplication or another NIF/BIF implementation.\n\n## C ABI\n\n`include/nifkit.h` exposes byte-length APIs for C, C++, Rust, Node native\naddons, and FFI consumers. BIF is binary data, so neither input nor output uses\nNUL termination. Every successful output buffer must be released with\n`nifkit_free`.\n\n```c\nint nifkit_nif_to_bif(const void *nif_data, size_t nif_len,\n                      void **out_bif, size_t *out_len);\nint nifkit_bif_to_nif(const void *bif_data, size_t bif_len,\n                      void **out_nif, size_t *out_len);\nint nifkit_validate_bif(const void *bif_data, size_t bif_len);\nvoid nifkit_free(void *buffer);\nconst char *nifkit_last_error(void);\n```\n\nAll conversion functions return `0` on success and non-zero on failure.\n`nifkit_last_error()` is thread-local. Inputs are byte slices; passing `NULL`\nwith a non-zero length is an error. Outputs are always reset before conversion.\nReturned buffers may contain NUL bytes, so callers must use the returned length.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuffball1567%2Fnifkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuffball1567%2Fnifkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuffball1567%2Fnifkit/lists"}