{"id":33191308,"url":"https://github.com/corsis/XParsec","last_synced_at":"2025-11-21T00:02:03.069Z","repository":{"id":4671022,"uuid":"5817266","full_name":"corsis/XParsec","owner":"corsis","description":"extensible, type-and-source-polymorphic, non-linear applicative parser combinator library for F# 3.0 and 4.0","archived":false,"fork":false,"pushed_at":"2018-03-14T20:34:47.000Z","size":199,"stargazers_count":50,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-09T23:38:25.725Z","etag":null,"topics":["combinator","extensible","f-sharp","library","mit-licensed","parser","parser-combinators"],"latest_commit_sha":null,"homepage":"http://xparsec.corsis.tech","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/corsis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-15T03:31:24.000Z","updated_at":"2024-11-10T17:22:43.000Z","dependencies_parsed_at":"2022-08-06T17:30:10.838Z","dependency_job_id":null,"html_url":"https://github.com/corsis/XParsec","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/corsis/XParsec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corsis%2FXParsec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corsis%2FXParsec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corsis%2FXParsec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corsis%2FXParsec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/corsis","download_url":"https://codeload.github.com/corsis/XParsec/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corsis%2FXParsec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285532343,"owners_count":27187706,"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","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["combinator","extensible","f-sharp","library","mit-licensed","parser","parser-combinators"],"created_at":"2025-11-16T06:00:41.329Z","updated_at":"2025-11-21T00:02:03.057Z","avatar_url":"https://github.com/corsis.png","language":"F#","readme":"```\nVersion 2 of this library is being built as part of a larger fundraising project.\n```\n\n- [x] Rename primitives for clarity\n- [ ] Comprehensive documentation\n- [x] Generalized parser negation `-`\n- [x] Steps in `uint64` instead of `int` (to be used with very large data sets)\n- [x] XParsec.fs (primitives; operators; combinators)\n- [x] XParsec.Array.fs [parse any 1D source]\n- [x] XParsec.Xml.Linq.fs [parse System.Xml.Linq trees]\n- [ ] [XParsec.Fable.Html.fs](https://home.corsis.tech/fable.html) (click last link) [parse browser DOM trees]\n- [ ] [XParsec + PDF.js (tech demo)](https://home.corsis.tech/) [parse PDF pages, PDF documents]\n      ![docpar]\n\n---\n\n```\nVersion 1 examples below.\n```\n\n**XParsec** works with **[any type](https://github.com/corsis/XParsec/blob/master/XParsec.fsi#L26)**, is **[very easy to extend](https://github.com/corsis/XParsec/blob/master/XParsec.fs#L81)**, supports **[domain-specific non-linear navigation](https://github.com/corsis/XParsec/blob/master/XParsec.fs#L122)** and is **[implemented in a single F# file with just ~100 source lines of code](https://github.com/corsis/XParsec/blob/master/XParsec.fs)**.\n\n(FParsec only works with `Char`s and can only go forward on a one dimensional `String`.)\n\n# Example 1\n\n**[XParsec.Xml](https://github.com/corsis/XParsec/blob/master/XParsec.fsi#L65)** is the first XParsec extension. It is **implemented in just 14 source lines of code** for the examples used below and provides complete freedom in navigating XML trees.\n\n```fsharp\nopen XParsec\nopen XParsec.Xml\n\n[\u003cEntryPoint\u003e]\nlet main _ =\n\n  let test parse = printfn \"%A\" \u003c\u003c reply \u003c\u003c parse \u003c\u003c E.source\n\n  let root = E.Parse \"\u003croot\u003e\u003ca\u003e\u003cb\u003e\u003cc\u003e\u003cd font='Arial'\u003e\u003c/d\u003e\u003c/c\u003e\u003c/b\u003e\u003c/a\u003e\u003c/root\u003e\"\n\n  //            domain-specific\n  //              navigation\n  //                  v\n  let parser1 = many (child =\u003e name) .\u003e. !@\"font\"\n  //            ^           ^\n  //         powerful     first-class\n  //      combinators     extensibility\n\n  // graceful choices\n  let parser2 = (parent =\u003e name) \u003c/\u003e (!*child \u003e. !@\"font\")\n\n  // graceful non-linear look-ahead (here = down in Xml)\n  let parser3 = !!parser1 .\u003e. (current =\u003e name)\n\n  // brand-new non-linear look-back (here = up   in Xml)\n  let S d,_   = E.source root |\u003e (!*child \u003e. current)\n  let parser4 = !!(many (parent =\u003e name)) .\u003e. (current =\u003e name)\n\n  test parser1 root; test parser2 root; test parser3 root; test parser4 d; 0\n```\n```fsharp\nS ([\"a\"; \"b\"; \"c\"; \"d\"], \"Arial\")\nS \"Arial\"\nS (([\"a\"; \"b\"; \"c\"; \"d\"], \"Arial\"), \"root\")\nS ([\"c\"; \"b\"; \"a\"; \"root\"], \"d\")\n```\n\n# Example 2\n\nRecursion \u0026ndash; handled with ease.\n\n```fsharp\nopen XParsec\nopen XParsec.Xml\n\ntype Xobj  = I of int | L of Xobj list\n\n[\u003cEntryPoint\u003e]\nlet main _ =\n\n  let root = E.Parse \"\u003clist\u003e\u003cint v='1'/\u003e\u003clist\u003e\u003cint v='2'/\u003e\u003c/list\u003e\u003cint v='3'/\u003e\u003c/list\u003e\"\n\n  let e,e' = future ()\n\n  let int_ = !\u003c\u003e\"int\"  \u003e. !@\"v\"      =\u003e (Int32.Parse \u003e\u003e I)\n  let list = !\u003c\u003e\"list\" \u003e. children e =\u003e                 L\n\n  do  e'  := int_ \u003c/\u003e list\n\n  test e root; 0\n```\n```fsharp\nS (L [I 1; L [I 2]; I 3])\n```\n\n# Browse\n\n+ [Signatures](https://github.com/corsis/XParsec/blob/master/XParsec.fsi#slider)\n+ [Implementation](https://github.com/corsis/XParsec/blob/master/XParsec.fs#slider)\n\n# License\n\n```\nXParsec™ © 2012 – 2018 Cetin Sert\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n\n    * Redistributions in binary form must reproduce the above\n      copyright notice, this list of conditions and the following\n      disclaimer in the documentation and/or other materials provided\n      with the distribution.\n\n    * The names of contributors may not be used to endorse or promote\n      products derived from this software without specific prior\n      written permission. \n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n```\n\n# Contact\n\n[![corsis]](https://github.com/corsis)\n\n[![cssign]](https://github.com/cetinsert)\n\n[xparsec@corsis.tech](mailto:xparsec@corsis.tech)\n\n[corsis]: https://home.corsis.tech/marketing/images/ipw/karamalz/corsis.png \"Corsis Research\"\n[cssign]: https://home.corsis.tech/marketing/images/ipw/karamalz/sig.100.tr.png \"Cetin Sert\"\n[docpar]: https://home.corsis.tech/marketing/images/ipw/hansol/cofs1.png \"Document Parsing\"\n","funding_links":[],"categories":["Parsing"],"sub_categories":["Performance Analysis"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorsis%2FXParsec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorsis%2FXParsec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorsis%2FXParsec/lists"}