{"id":17774945,"url":"https://github.com/fnogatz/plammar","last_synced_at":"2026-02-11T17:35:31.934Z","repository":{"id":47732772,"uuid":"186686338","full_name":"fnogatz/plammar","owner":"fnogatz","description":"A Prolog grammar written in Prolog, for parsing and serialising Prolog code.","archived":false,"fork":false,"pushed_at":"2021-08-16T08:13:16.000Z","size":269,"stargazers_count":15,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-16T13:53:36.959Z","etag":null,"topics":["definite-clause-grammar","parser","prolog","serializer","swi-prolog"],"latest_commit_sha":null,"homepage":null,"language":"Prolog","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/fnogatz.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}},"created_at":"2019-05-14T19:25:05.000Z","updated_at":"2025-08-12T18:49:17.000Z","dependencies_parsed_at":"2022-08-23T09:00:21.954Z","dependency_job_id":null,"html_url":"https://github.com/fnogatz/plammar","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fnogatz/plammar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnogatz%2Fplammar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnogatz%2Fplammar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnogatz%2Fplammar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnogatz%2Fplammar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnogatz","download_url":"https://codeload.github.com/fnogatz/plammar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnogatz%2Fplammar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29339710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T16:14:43.024Z","status":"ssl_error","status_checked_at":"2026-02-11T16:14:15.258Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["definite-clause-grammar","parser","prolog","serializer","swi-prolog"],"created_at":"2024-10-26T21:54:14.232Z","updated_at":"2026-02-11T17:35:31.920Z","avatar_url":"https://github.com/fnogatz.png","language":"Prolog","funding_links":[],"categories":[],"sub_categories":[],"readme":"# plammar\n\nA Prolog grammar written in Prolog, for parsing and serialising Prolog code.\n\n## Installation\n\nFirst, you need [SWI-Prolog](http://www.swi-prolog.org/). See there for installation instructions.\n\nWe make use of the following packages:\n- [`library(tap)`](https://github.com/fnogatz/tap)\n- [`library(dcg4pt)`](https://github.com/fnogatz/dcg4pt)\n- [`library(cli_table)`](https://github.com/fnogatz/cli_table)\n\nAll can be installed by calling the following query in SWI-Prolog:\n\n```prolog\n?- pack_install(tap), pack_install(dcg4pt), pack_install(cli_table).\n```\n\n### Development Version\n\nTo get the latest development version, clone it via git and link it to the package directory of SWI-Prolog:\n\n```sh\ngit clone https://github.com/fnogatz/plammar.git\nln -s $PWD/plammar $(swipl -q -g \"absolute_file_name(pack(.),D,[file_type(directory)]), write(D), halt\")\n```\n\n### Pre-Compilation\n\nIt is possible to create a pre-compiled file which increases the tool's performance significantly. The command line interface is compiled using swipl's [`-c` option](https://www.swi-prolog.org/pldoc/man?section=compilation):\n\n```sh\nswipl -g main -o cli.exe -c cli.pl\n```\n\nThe `.exe` suffix is chosen for compatibility with Windows systems. You can also use `make cli` to generate the pre-compiled CLI.\n\n## Usage with SWI-Prolog\n\nFirst, load the package:\n\n```prolog\n?- use_module(library(plammar)).\n```\n\nExamples:\n\n```\n?- prolog_tokens(string(\"a(1).\"), Tokens).\n?- prolog_parsetree(string(\"a(1).\"), PT).\n?- prolog_ast(string(\"a(1).\"), AST).\n```\n\nAll three predicates can also take an additional `Options` list. The first argument accepts several data formats, including `string(_)`, `file(_)`, `stream(_)`, `chars(_)` and `tokens(_)`. The predicates can be used to parse and serialise Prolog source code.\n\nFor more examples, have a look at the `/test` directory.\n\n## Usage as CLI\n\nplammar comes with a command line interface to parse given source code. You can directly execute it via\n\n```sh\nswipl -g main cli.pl -- [options] [\u003cfilename\u003e]\n```\n\nCall with `--help` instead of the filenames to get more options. The CLI accepts a filename as the first argument. If called without this filename, the source is read from stdin.\n\nAfter the pre-compilation step mentioned before, the created executable can be called via:\n\n```sh\n./cli.exe [options] [\u003cfilename\u003e]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnogatz%2Fplammar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnogatz%2Fplammar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnogatz%2Fplammar/lists"}