{"id":17495830,"url":"https://github.com/iraikov/chicken-csv-abnf","last_synced_at":"2026-01-05T14:54:54.102Z","repository":{"id":148366451,"uuid":"148797778","full_name":"iraikov/chicken-csv-abnf","owner":"iraikov","description":"Parsing and formatting of comma-separated values (CSV) according to RFC 4180","archived":false,"fork":false,"pushed_at":"2019-05-05T22:31:28.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T16:28:21.361Z","etag":null,"topics":["abnf","csv","parser-combinators","scheme"],"latest_commit_sha":null,"homepage":null,"language":"Scheme","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iraikov.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}},"created_at":"2018-09-14T14:10:54.000Z","updated_at":"2023-05-24T15:41:30.000Z","dependencies_parsed_at":"2023-05-13T18:30:45.803Z","dependency_job_id":null,"html_url":"https://github.com/iraikov/chicken-csv-abnf","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fchicken-csv-abnf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fchicken-csv-abnf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fchicken-csv-abnf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fchicken-csv-abnf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iraikov","download_url":"https://codeload.github.com/iraikov/chicken-csv-abnf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245525756,"owners_count":20629832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["abnf","csv","parser-combinators","scheme"],"created_at":"2024-10-19T14:34:18.633Z","updated_at":"2026-01-05T14:54:54.075Z","avatar_url":"https://github.com/iraikov.png","language":"Scheme","funding_links":[],"categories":[],"sub_categories":[],"readme":"csv-abnf\n-------\n\n### Description\n\nThe library contains procedures for parsing and formatting of\ncomma-separated values (CSV) as described in [RFC\n4180](http://tools.ietf.org/html/rfc4180). There are several\ndifferences with the RFC:\n\n- The RFC prescribes CRLF standard network line breaks, but many CSV files have platform-dependent line endings, so this library accepts any sequence of CRs and LFs as a line break.\n- The format of header lines is exactly like a regular record and the presence of a header can only be determined from the mime type. This library treats all lines as regular records.\n-   The formal grammar specifies that fields can contain only certain US ASCII characters, but the specification of the MIME type allows for other character sets. This library allow all characters in fields, except for the field delimiter character, CRs and LFs in unquoted fields.\n- According to the RFC, the records all have to have the same length. This library allows variable length records. \n- The delimiter character is specified by the user and can be a character other than comma, or an SRFI-14 character set.\n\n### Library Procedures\n\n\u003cprocedure\u003e\n(csv-record? X) =\u0026gt; BOOL\n\u003c/procedure\u003e\nReturns {{#t}} if the given object is a csv record, {{#f}} otherwise.\n\n\u003cprocedure\u003e\n(list-\u0026gt;csv-record LIST) =\u0026gt; CSV-RECORD\n\u003c/procedure\u003e\nTakes in a list of values and creates a object.\n\n\u003cprocedure\u003e\n(csv-record-\u0026gt;list CSV-RECORD) =\u0026gt; LIST\n\u003c/procedure\u003e\nReturns the list of values contained in the given object.\n\n#### Parsing Procedures: \n\n\u003cprocedure\u003e\n(csv-parser \\[DELIMITER\\]) =\u0026gt; PARSER\n\u003c/procedure\u003e\nWhen invoked, returns a parser procedure takes in a list of characters\nand returns a list of the form:\n\n ((\u003c#csv-record (FIELD1 FIELD2 ...)\u003e) (\u003c#csv-record ... \u003e))\n\nwhere represents the field values in a record.\n\nOptional argument DELIMITER is the field delimiter character, if other than\ncomma.\n\n\u003cprocedure\u003e\n(make-parser CSV-INSTANCE) =\u0026gt; (LAMBDA \\[DELIMITER\\]) =\u0026gt; PARSER\n\u003c/procedure\u003e\n\nOnce applied to an instance of the {{\u003cCSV\u003e}} typeclass, returns a\nconstructor for the CSV parsing procedure. Optional argument specifies\nthe field delimiter (comma by default). can be a character, or an\nSRFI-14 character set. The returned procedure takes in an input stream\nand returns a list of the form:\n\n#### Formatting procedures\n\n\u003cprocedure\u003e\n(make-format \\[DELIMITER\\]) =\u0026gt; FORMAT-CELL \\* FORMAT-RECORD \\* FORMAT-CSV\n\u003c/procedure\u003e\n\nReturns procedures for outputting individual field values, CSV records,\nand lists of CSV records, where each list is printed on a separate line.\n\nProcedure takes in a value, obtains its string representation via , and\nsurrounds the string with quotes, if it contains characters that need to\nbe escaped (such as quote characters, the delimiter character, or\nnewlines).\n\nProcedure takes in a record of type and returns its string\nrepresentation, based on the strings produced by and the delimiter\ncharacter.\n\nProcedure takes in a list of objects and produces a string\nrepresentation using .\n\nExample:\n\n```scheme\n(import csv-abnf)\n\n(define-values (fmt-cell fmt-record fmt-csv) (make-format “;”))\n\n(fmt-cell “hello”) =\u0026gt; “hello”\n\n; This is quoted because it contains delimiter-characters\n\n(fmt-cell “one;two;three”) =\u0026gt; “\\\\”one;two;three\\\\\"\"\n\n; This is quoted because it contains quotes, which are then doubled for escaping\n\n(fmt-cell “say \\\\”hi\\\\\"\") =\u0026gt; “\\\\”say \\\\“\\\\”hi\\\\“\\\\”\\\\\"\"\n\n; Converts one line at a time (useful when converting data in a streaming manner)\n\n(fmt-record (list-\u0026gt;csv-record '(“hi there” “let's say \\\\”hello\nworld\\\\\" again\" “until we are bored”))) =\u0026gt; “hi there;\\\\”let's say\n\\\\“\\\\”hello world\\\\“\\\\” again\\\\“;until we are bored”\n\n; And an example of how to quickly convert a list of lists\\\n; to a CSV string containing the entire CSV file\n\n(fmt-csv (map list-\u0026gt;csv-record\n```\n\n### Author\n\n Copyright 2009-2019 Ivan Raikov\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firaikov%2Fchicken-csv-abnf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firaikov%2Fchicken-csv-abnf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firaikov%2Fchicken-csv-abnf/lists"}