Staged selective parser combinators
Parser combinators are a middle ground between the fine control of hand-rolled parsers and the high-level almost grammar-like appearance of parsers created via parser generators. They also promote a cleaner, compositional design for parsers. Historically, however, they cannot match the performance o...
Saved in:
| Published in: | Proceedings of ACM on programming languages Vol. 4; no. ICFP; pp. 1 - 30 |
|---|---|
| Main Authors: | , , |
| Format: | Journal Article |
| Language: | English |
| Published: |
02.08.2020
|
| ISSN: | 2475-1421, 2475-1421 |
| Online Access: | Get full text |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
| Abstract | Parser combinators are a middle ground between the fine control of hand-rolled parsers and the high-level almost grammar-like appearance of parsers created via parser generators. They also promote a cleaner, compositional design for parsers. Historically, however, they cannot match the performance of their counterparts.
This paper describes how to compile parser combinators into parsers of hand-written quality. This is done by leveraging the static information present in the grammar by representing it as a tree. However, in order to exploit this information, it will be necessary to drop support for monadic computation since this generates dynamic structure. Selective functors can help recover lost functionality in the absence of monads, and the parser tree can be partially evaluated with staging. This is implemented in a library called Parsley. |
|---|---|
| AbstractList | Parser combinators are a middle ground between the fine control of hand-rolled parsers and the high-level almost grammar-like appearance of parsers created via parser generators. They also promote a cleaner, compositional design for parsers. Historically, however, they cannot match the performance of their counterparts.
This paper describes how to compile parser combinators into parsers of hand-written quality. This is done by leveraging the static information present in the grammar by representing it as a tree. However, in order to exploit this information, it will be necessary to drop support for monadic computation since this generates dynamic structure. Selective functors can help recover lost functionality in the absence of monads, and the parser tree can be partially evaluated with staging. This is implemented in a library called Parsley. |
| Author | Wu, Nicolas Pickering, Matthew Willis, Jamie |
| Author_xml | – sequence: 1 givenname: Jamie surname: Willis fullname: Willis, Jamie organization: Imperial College London, UK – sequence: 2 givenname: Nicolas orcidid: 0000-0002-4161-985X surname: Wu fullname: Wu, Nicolas organization: Imperial College London, UK – sequence: 3 givenname: Matthew surname: Pickering fullname: Pickering, Matthew organization: University of Bristol, UK |
| BookMark | eNplj0tLAzEUhYNUsNbiXxhw4Sqa18wkSym-oOBCXQ-3NzcSmU5KEgT_vRW7EF2dc-DjwHfKZlOaiLFzKa6kNO21NsIJoY7YXJm-5dIoOfvVT9iylHchhHTaWO3m7OK5whv5ptBIWOMHNTvIhXKDabuJE9SUyxk7DjAWWh5ywV7vbl9WD3z9dP-4ullzVK2tvFfgMHiprd8YiwTK6wA2eK8742zvdUvYWeNcJ9AFgWG_rfEePPUKlV6wy59fzKmUTGHY5biF_DlIMXzrDQe9Pcn_kBgr1JimmiGO__gvaK5R7A |
| CitedBy_id | crossref_primary_10_1145_3498723 crossref_primary_10_1145_3747518 crossref_primary_10_1016_j_cogsys_2023_101183 crossref_primary_10_3390_math11071594 crossref_primary_10_1145_3547632 crossref_primary_10_1016_j_cola_2022_101172 |
| Cites_doi | 10.1007/3-540-13346-1_15 10.1007/11575467_24 10.1017/S0956796801004178 10.1017/S0956796807006326 10.1145/2034574.2034777 10.1145/3341694 10.1007/978-3-642-03153-3_6 10.1145/2714064.2660241 10.1145/3241653.3241656 10.1145/773473.178246 10.1145/3314221.3314625 10.1145/2500365.2500578 10.1145/3360553 10.1145/2628136.2628138 10.1017/S0956796812000226 10.1145/3110273 10.1145/236114.236119 10.1145/1942788.1868314 10.1007/978-3-319-19797-5 10.1145/242224.242477 10.1145/982962.964011 10.1145/1017472.1017485 10.1145/321239.321249 10.1145/2633357.2633358 10.1145/2980983.2908128 10.1145/636517.636528 10.1145/256167.256195 10.1007/3-540-15975-4_33 10.1145/2502488.2502496 10.1145/1291151.1291179 10.1145/1596638.1596653 10.1145/3294032.3294078 10.1145/1411286.1411296 10.1145/2692915.2628144 10.1145/3236780 10.1145/331963.331977 10.1145/258994.259019 10.1145/3062341.3062380 10.1145/2775050.2633369 10.1017/S0956796800000411 |
| ContentType | Journal Article |
| DBID | AAYXX CITATION |
| DOI | 10.1145/3409002 |
| DatabaseName | CrossRef |
| DatabaseTitle | CrossRef |
| DatabaseTitleList | CrossRef |
| DeliveryMethod | fulltext_linktorsrc |
| Discipline | Computer Science |
| EISSN | 2475-1421 |
| EndPage | 30 |
| ExternalDocumentID | 10_1145_3409002 |
| GroupedDBID | AAKMM AAYFX AAYXX ACM AEFXT AEJOY AIKLT AKRVB ALMA_UNASSIGNED_HOLDINGS CITATION GUFHI LHSKQ M~E OK1 ROL |
| ID | FETCH-LOGICAL-c258t-72a9cfd138db48cea2d3fa8fdd364987d35ec6849960c9f0cf5ec84ddade72c23 |
| ISICitedReferencesCount | 14 |
| ISICitedReferencesURI | http://www.webofscience.com/api/gateway?GWVersion=2&SrcApp=Summon&SrcAuth=ProQuest&DestLinkType=CitingArticles&DestApp=WOS_CPL&KeyUT=000685203700034&url=https%3A%2F%2Fcvtisr.summon.serialssolutions.com%2F%23%21%2Fsearch%3Fho%3Df%26include.ft.matches%3Dt%26l%3Dnull%26q%3D |
| ISSN | 2475-1421 |
| IngestDate | Tue Nov 18 22:27:53 EST 2025 Sat Nov 29 07:48:19 EST 2025 |
| IsDoiOpenAccess | false |
| IsOpenAccess | true |
| IsPeerReviewed | true |
| IsScholarly | true |
| Issue | ICFP |
| Language | English |
| LinkModel | OpenURL |
| MergedId | FETCHMERGED-LOGICAL-c258t-72a9cfd138db48cea2d3fa8fdd364987d35ec6849960c9f0cf5ec84ddade72c23 |
| ORCID | 0000-0002-4161-985X |
| OpenAccessLink | https://dl.acm.org/doi/pdf/10.1145/3409002 |
| PageCount | 30 |
| ParticipantIDs | crossref_primary_10_1145_3409002 crossref_citationtrail_10_1145_3409002 |
| PublicationCentury | 2000 |
| PublicationDate | 2020-08-02 |
| PublicationDateYYYYMMDD | 2020-08-02 |
| PublicationDate_xml | – month: 08 year: 2020 text: 2020-08-02 day: 02 |
| PublicationDecade | 2020 |
| PublicationTitle | Proceedings of ACM on programming languages |
| PublicationYear | 2020 |
| References | e_1_2_2_24_1 e_1_2_2_6_1 e_1_2_2_22_1 e_1_2_2_2_1 e_1_2_2_41_1 e_1_2_2_43_1 e_1_2_2_8_1 e_1_2_2_28_1 e_1_2_2_26_1 e_1_2_2_47_1 Fowler Martin (e_1_2_2_13_1) e_1_2_2_38_1 e_1_2_2_30_1 e_1_2_2_51_1 e_1_2_2_19_1 e_1_2_2_32_1 e_1_2_2_53_1 Appel Andrew W. (e_1_2_2_4_1) e_1_2_2_17_1 e_1_2_2_15_1 e_1_2_2_36_1 Voigtländer Janis (e_1_2_2_49_1) e_1_2_2_48_1 e_1_2_2_5_1 e_1_2_2_23_1 e_1_2_2_7_1 e_1_2_2_21_1 e_1_2_2_1_1 e_1_2_2_40_1 Aho Alfred V. (e_1_2_2_3_1) 2006 e_1_2_2_42_1 e_1_2_2_29_1 e_1_2_2_44_1 e_1_2_2_27_1 e_1_2_2_46_1 Leijen Daan (e_1_2_2_33_1) 2001 e_1_2_2_14_1 e_1_2_2_37_1 e_1_2_2_12_1 e_1_2_2_39_1 e_1_2_2_10_1 Delbianco Germán Andrés (e_1_2_2_9_1) e_1_2_2_52_1 e_1_2_2_31_1 e_1_2_2_54_1 Wadler Philip (e_1_2_2_50_1) e_1_2_2_16_1 e_1_2_2_35_1 Hinze Ralf (e_1_2_2_20_1) Doaitse Swierstra S. (e_1_2_2_45_1) |
| References_xml | – ident: e_1_2_2_39_1 doi: 10.1007/3-540-13346-1_15 – ident: e_1_2_2_6_1 doi: 10.1007/11575467_24 – ident: e_1_2_2_41_1 doi: 10.1017/S0956796801004178 – ident: e_1_2_2_37_1 – ident: e_1_2_2_38_1 doi: 10.1017/S0956796807006326 – ident: e_1_2_2_14_1 doi: 10.1145/2034574.2034777 – ident: e_1_2_2_40_1 doi: 10.1145/3341694 – ident: e_1_2_2_44_1 doi: 10.1007/978-3-642-03153-3_6 – ident: e_1_2_2_26_1 doi: 10.1145/2714064.2660241 – ident: e_1_2_2_51_1 doi: 10.1145/3241653.3241656 – ident: e_1_2_2_31_1 doi: 10.1145/773473.178246 – volume-title: Mathematics of Program Construction, Philippe Audebaud and Christine Paulin-Mohring (Eds.) ident: e_1_2_2_49_1 – volume-title: Domain Specific Languages ident: e_1_2_2_13_1 – ident: e_1_2_2_30_1 doi: 10.1145/3314221.3314625 – ident: e_1_2_2_22_1 doi: 10.1145/2500365.2500578 – ident: e_1_2_2_17_1 – ident: e_1_2_2_19_1 doi: 10.1145/3360553 – ident: e_1_2_2_15_1 doi: 10.1145/2628136.2628138 – volume-title: Error-Correcting Combinator Parsers. In Advanced Functional Programming, Second International School-Tutorial Text ident: e_1_2_2_45_1 – ident: e_1_2_2_10_1 doi: 10.1017/S0956796812000226 – ident: e_1_2_2_53_1 doi: 10.1145/3110273 – ident: e_1_2_2_8_1 doi: 10.1145/236114.236119 – ident: e_1_2_2_42_1 doi: 10.1145/1942788.1868314 – volume-title: Mathematics of Program Construction ident: e_1_2_2_20_1 doi: 10.1007/978-3-319-19797-5 – ident: e_1_2_2_47_1 – volume-title: Ullman year: 2006 ident: e_1_2_2_3_1 – ident: e_1_2_2_23_1 doi: 10.1145/242224.242477 – ident: e_1_2_2_12_1 doi: 10.1145/982962.964011 – ident: e_1_2_2_5_1 doi: 10.1145/1017472.1017485 – ident: e_1_2_2_7_1 doi: 10.1145/321239.321249 – ident: e_1_2_2_52_1 doi: 10.1145/2633357.2633358 – ident: e_1_2_2_2_1 doi: 10.1145/2980983.2908128 – ident: e_1_2_2_43_1 doi: 10.1145/636517.636528 – ident: e_1_2_2_29_1 doi: 10.1145/256167.256195 – volume-title: Compiling with Continuations ident: e_1_2_2_4_1 – volume-title: How to replace failure by a list of successes a method for exception handling, backtracking, and pattern matching in lazy functional languages ident: e_1_2_2_50_1 doi: 10.1007/3-540-15975-4_33 – ident: e_1_2_2_21_1 doi: 10.1145/2502488.2502496 – ident: e_1_2_2_27_1 doi: 10.1145/1291151.1291179 – ident: e_1_2_2_16_1 doi: 10.1145/1596638.1596653 – ident: e_1_2_2_54_1 doi: 10.1145/3294032.3294078 – ident: e_1_2_2_48_1 doi: 10.1145/1411286.1411296 – ident: e_1_2_2_35_1 doi: 10.1145/2692915.2628144 – volume-title: Trends in Functional Programming, Ricardo Peña and Rex Page (Eds.) ident: e_1_2_2_9_1 – ident: e_1_2_2_28_1 doi: 10.1145/3236780 – ident: e_1_2_2_32_1 doi: 10.1145/331963.331977 – ident: e_1_2_2_46_1 doi: 10.1145/258994.259019 – volume-title: Parsec: Direct Style Monadic Parser Combinators For The Real World. Technical Report. Microsoft. year: 2001 ident: e_1_2_2_33_1 – ident: e_1_2_2_36_1 doi: 10.1145/3062341.3062380 – ident: e_1_2_2_1_1 doi: 10.1145/2775050.2633369 – ident: e_1_2_2_24_1 doi: 10.1017/S0956796800000411 |
| SSID | ssj0001934839 |
| Score | 2.2343156 |
| Snippet | Parser combinators are a middle ground between the fine control of hand-rolled parsers and the high-level almost grammar-like appearance of parsers created via... |
| SourceID | crossref |
| SourceType | Enrichment Source Index Database |
| StartPage | 1 |
| Title | Staged selective parser combinators |
| Volume | 4 |
| WOSCitedRecordID | wos000685203700034&url=https%3A%2F%2Fcvtisr.summon.serialssolutions.com%2F%23%21%2Fsearch%3Fho%3Df%26include.ft.matches%3Dt%26l%3Dnull%26q%3D |
| hasFullText | 1 |
| inHoldings | 1 |
| isFullTextHit | |
| isPrint | |
| journalDatabaseRights | – providerCode: PRVHPJ databaseName: ROAD: Directory of Open Access Scholarly Resources customDbUrl: eissn: 2475-1421 dateEnd: 99991231 omitProxy: false ssIdentifier: ssj0001934839 issn: 2475-1421 databaseCode: M~E dateStart: 20170101 isFulltext: true titleUrlDefault: https://road.issn.org providerName: ISSN International Centre |
| link | http://cvtisr.summon.serialssolutions.com/2.0.0/link/0/eLvHCXMwtV07T8MwELagMLDwRpSXIoHYAonjNM5YVVQwtMpQpG6VazuoEoSqaVEnfjvn2HVNQQIGFiux7Lw-53x3Pt-H0BVmeZxLzH3KJRgoEZEVzYsfNFgshgEJhwGryCaSbpf2-2lmEiqUFZ1AUhR0Pk_H_wo11AHYauvsH-C2F4UKOAbQoQTYofwV8KA-PoEWWVYENyouaAy2q5yo4HGwgpWNXboaaWZnsCqoo9nqqPUDE7b1ohwJC5em1b4rH01pYmxHy8WdmR1azLbNRipuwxCnGHJx19OAdZyb43zEJIn9kOgdzTfymzojUYkzcB5a7cwRkKEz0-oFma8ynKh0FxEYnoG5-6cs2Suzl40p1Dus44HpuI42cBKnStB13h23WxoRWvHL2SfXW6lV31vT19FRHGWjt4u2jZXgNTW6e2hNFvtoZ8HA4RmBfIAuNdieBdvTYHsO2IfosX3Xa937hvbC5zimUz_BLOW5CCMqhgR-IYZFlDOaCxE1SEoTEcWSNyhReXV4mgc8h3NKhGBCJpjj6AjVitdCHiNPUSsxKZIUy5CElFGcK_00YCEYznwo6-h68aIDbnLCK2qS58HK16wjzzYc6zQoq01Ofm5yiraW4-oM1aaTmTxHm_xtOionFxVQH3ZxTuM |
| linkProvider | ISSN International Centre |
| openUrl | ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3AUTF-8&rfr_id=info%3Asid%2Fsummon.serialssolutions.com&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.atitle=Staged+selective+parser+combinators&rft.jtitle=Proceedings+of+ACM+on+programming+languages&rft.au=Willis%2C+Jamie&rft.au=Wu%2C+Nicolas&rft.au=Pickering%2C+Matthew&rft.date=2020-08-02&rft.issn=2475-1421&rft.eissn=2475-1421&rft.volume=4&rft.issue=ICFP&rft.spage=1&rft.epage=30&rft_id=info:doi/10.1145%2F3409002&rft.externalDBID=n%2Fa&rft.externalDocID=10_1145_3409002 |
| thumbnail_l | http://covers-cdn.summon.serialssolutions.com/index.aspx?isbn=/lc.gif&issn=2475-1421&client=summon |
| thumbnail_m | http://covers-cdn.summon.serialssolutions.com/index.aspx?isbn=/mc.gif&issn=2475-1421&client=summon |
| thumbnail_s | http://covers-cdn.summon.serialssolutions.com/index.aspx?isbn=/sc.gif&issn=2475-1421&client=summon |