{"id":50816053,"url":"https://github.com/ydah/phison","last_synced_at":"2026-06-13T09:33:42.866Z","repository":{"id":357145055,"uuid":"1235311481","full_name":"ydah/phison","owner":"ydah","description":"A LALR(1) parser generator for PHP.","archived":false,"fork":false,"pushed_at":"2026-05-11T13:32:42.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-11T15:30:27.823Z","etag":null,"topics":["bison","code-generation","compiler","composer-package","dsl","grammar","lalr","lalr-parser","lr-parser","parser-generator","parsing","php","yacc"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/ydah.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-11T07:50:50.000Z","updated_at":"2026-05-11T13:38:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ydah/phison","commit_stats":null,"previous_names":["ydah/phison"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ydah/phison","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydah%2Fphison","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydah%2Fphison/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydah%2Fphison/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydah%2Fphison/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ydah","download_url":"https://codeload.github.com/ydah/phison/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydah%2Fphison/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34279898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"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":["bison","code-generation","compiler","composer-package","dsl","grammar","lalr","lalr-parser","lr-parser","parser-generator","parsing","php","yacc"],"created_at":"2026-06-13T09:33:42.776Z","updated_at":"2026-06-13T09:33:42.860Z","avatar_url":"https://github.com/ydah.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phison\n\nPhison is a dependency-free LALR(1) parser generator for PHP. It reads a\nsmall `.y` grammar DSL and emits a PHP parser class that consumes an\nexternal `TokenStreamInterface`.\n\n## Install\n\n```bash\ncomposer require ydah/phison --dev\n```\n\nUse `vendor/bin/phison` from installed projects, or `bin/phison` when working\nfrom this repository.\n\n## Generate a parser\n\n```bash\nbin/phison generate examples/arithmetic/arithmetic.y \\\n  --output examples/arithmetic/Generated/ArithmeticParser.php \\\n  --target-php=8.2 \\\n  --table-layout=hybrid \\\n  --report build/arithmetic-report.md\n```\n\nThe generator does not create a lexer. Grammar files embed PHP semantic\nactions and must be treated as trusted source code.\n\n## Run examples\n\n```bash\ncomposer generate:examples\ncomposer run:examples\n```\n\nThe example catalog includes arithmetic, JSON, CSV, filter-query, and\nINI-like config parsers. See [examples/README.md](examples/README.md).\n\n## Validate a grammar\n\n```bash\nbin/phison validate examples/arithmetic/arithmetic.y\n```\n\n## Inspect a grammar\n\n```bash\nbin/phison inspect examples/arithmetic/arithmetic.y --state=0\n```\n\n## Dump the automaton\n\n```bash\nbin/phison generate examples/arithmetic/arithmetic.y \\\n  --output build/ArithmeticParser.php \\\n  --dump-automaton build/arithmetic-automaton.txt\n```\n\n## Implemented options\n\n- `--namespace` and `--class` override the generated parser name.\n- `--target-php=8.2|8.3|8.4|8.5` controls generated PHP syntax. PHP 8.3+\n  targets use typed class constants and `#[\\Override]` interface checks.\n- `--table-layout=array|switch|packed|hybrid` controls ACTION/GOTO lookup\n  generation. The packed layout uses row sharing plus checked default\n  reductions for repeated reduce actions.\n- `--report` writes a Markdown grammar, conflict, and state report.\n- `--html-report` writes the same report as a standalone HTML file.\n- `--dump-automaton` prints or writes the LALR automaton.\n- `--lint` runs `php -l` on the generated parser.\n\n## Benchmark\n\n```bash\ncomposer benchmark\nphp benchmarks/arithmetic.php 50000 packed\n```\n\nThe arithmetic benchmark regenerates the example parser in a temporary file\nand reports elapsed time plus parses per second for the selected table layout.\n\n## Releases\n\nRelease tags use `vMAJOR.MINOR.PATCH` and are intended to be published through\nPackagist. See [docs/release.md](docs/release.md) for the versioning policy and\nrelease checklist.\n\n## DSL sketch\n\n```text\ngrammar Arithmetic\nnamespace App\\Generated\nparser ArithmeticParser\nstart expr\n\ntoken NUMBER display \"number\"\ntoken PLUS display \"+\"\n\nprecedence left PLUS\n\nrule expr {\n    left=expr PLUS right=expr =\u003e php {\n        return $left + $right;\n    }\n\n  | n=NUMBER =\u003e php {\n        return (int) $n;\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fydah%2Fphison","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fydah%2Fphison","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fydah%2Fphison/lists"}