{"id":13410404,"url":"https://github.com/flyx/ParserTools","last_synced_at":"2025-03-14T15:32:37.714Z","repository":{"id":140903997,"uuid":"101768842","full_name":"flyx/ParserTools","owner":"flyx","description":"tools for writing lexers / parsers in Ada","archived":false,"fork":false,"pushed_at":"2018-02-16T10:24:02.000Z","size":40,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-25T19:41:57.176Z","etag":null,"topics":["ada","lexer","reference-counting"],"latest_commit_sha":null,"homepage":"","language":"Ada","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/flyx.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"copying.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-08-29T14:12:30.000Z","updated_at":"2021-03-24T20:36:09.000Z","dependencies_parsed_at":"2023-06-01T10:30:38.220Z","dependency_job_id":null,"html_url":"https://github.com/flyx/ParserTools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyx%2FParserTools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyx%2FParserTools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyx%2FParserTools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyx%2FParserTools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flyx","download_url":"https://codeload.github.com/flyx/ParserTools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243600797,"owners_count":20317336,"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":["ada","lexer","reference-counting"],"created_at":"2024-07-30T20:01:06.697Z","updated_at":"2025-03-14T15:32:37.440Z","avatar_url":"https://github.com/flyx.png","language":"Ada","readme":"# ParserTools\n\nThis library provides several tools useful for writing lexers / parsers in Ada.\n\n## Text\n\nThis library provides a reference-counted type named `Text.Reference` that\npoints to a UTF-8 encoded `String` of variable length. It is designed to be used\nwith parsers that produce text nodes / tokens. It is most efficient for parsers\nthat are operated in a stream-like manner, i.e. produced parser events are\nprocessed when generated. It can also be used for a parser that builds up a full\nAST. However, it is inefficient in scenarios where generated items go out of\nscope in random order and new items are still generated while old items are\ngoing out of order.\n\n### Usage\n\n`Text.Pool` provides a custom allocator. This allocator is optimized based on\nthe following assumptions:\n\n * The deallocation of text objects occurs in the same order as the allocation.\n   This is no hard requirement, violations are tolerated, but may have an\n   impact on performance.\n * Since the parser may be used through a C-level API, all Strings shall have an\n   additional null terminator so that they can be efficiently exported to C.\n   This terminator shall be hidden from the Ada view of the string value.\n * No manual memory management shall be necessary, both the Text objects and the\n   Pool shall be reference-counted and automatically deallocated once the last\n   reference vanishes.\n * Text objects shall be immutable once created.\n\nTo optimize performance, the allocator carves memory from pre-allocated chunks.\nThere is no freelist; instead, the dope vectors of the Ada String objects are\nused to find the next free space. This way, adjacent free spaces can be\nefficiently merged and thus, memory fragmentation is avoided.\n\nThe automatic memory management comes at the cost of every Text object holding\na reference to the Pool it was created with. This is necessary to make sure the\nPool only deallocates a memory chunk once the last Text object goes out of\nscope.\n\n## Lexer\n\n`Lexer.Base` provides a base for a lexer. It is a translation of Nim's module\n[lexbase][1]. It provides efficient buffering for the lexer source. It is build\nfor parsing languages which have more or less regular linebreaks. The lexer\nonly needs to check whether it needs to refill the buffer at linebreak\ncharacters.\n\n### Usage\n\nAfter calling `Init` on the lexer, the next character can be queried with\n`Next`. Whenever `Next` returns a linebreak character, the user must call\n`Handle_LF` or `Handle_CR` (depending on the linebreak character) before\ncalling `Next` again. When the end of the input is reached, `Next` returns an\n*End of Transmission* (`Character'Val (4)`) character. This character must not\nbe allowed to be a part of the input.\n\n## License\n\n[MIT](copying.txt)\n\n [1]: https://nim-lang.org/docs/lexbase.html\n","funding_links":[],"categories":["Libraries"],"sub_categories":["Parsers, Scanners, Linters, Analysers, Interpreters and Prettyprinters"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflyx%2FParserTools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflyx%2FParserTools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflyx%2FParserTools/lists"}