{"id":15672391,"url":"https://github.com/siraben/meta-yacc","last_synced_at":"2025-09-08T02:34:46.441Z","repository":{"id":54275010,"uuid":"187961797","full_name":"siraben/meta-yacc","owner":"siraben","description":"Self-hosting parser generators in Forth and C.","archived":false,"fork":false,"pushed_at":"2021-02-27T16:41:07.000Z","size":36,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-24T21:26:15.688Z","etag":null,"topics":["c","forth","parser-generator"],"latest_commit_sha":null,"homepage":"","language":"Forth","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/siraben.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-22T04:17:53.000Z","updated_at":"2025-01-22T13:17:40.000Z","dependencies_parsed_at":"2022-08-13T10:40:42.933Z","dependency_job_id":null,"html_url":"https://github.com/siraben/meta-yacc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/siraben/meta-yacc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siraben%2Fmeta-yacc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siraben%2Fmeta-yacc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siraben%2Fmeta-yacc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siraben%2Fmeta-yacc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siraben","download_url":"https://codeload.github.com/siraben/meta-yacc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siraben%2Fmeta-yacc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274124135,"owners_count":25226293,"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-09-08T02:00:09.813Z","response_time":121,"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":["c","forth","parser-generator"],"created_at":"2024-10-03T15:25:19.708Z","updated_at":"2025-09-08T02:34:46.383Z","avatar_url":"https://github.com/siraben.png","language":"Forth","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Self-hosting YACC-like parser generators in Forth and C\n![Build\nStatus](https://github.com/siraben/meta-yacc/workflows/Build/badge.svg)\n\n## Building\n### C\n```ShellSession\n$ nix build # with Nix\n$ make # without Nix\n```\n### Forth\n```ShellSession\n$ gforth meta.fs meta-forth.txt meta.fs\n```\n### Regenerate C/Forth code\n```ShellSession\n$ make recomp # for C code\n$ make forth_recomp # for Forth code\n```\n## Usage\nSuppose one has a grammar file called `my-grammar.txt`:\n- Using the Forth parser generator, run `gforth meta.fs my-grammar.txt\n  my-grammar.fs`\n- Using the C parser generator, run `./meta my-grammar.txt\n  my-grammar.c`\n\nCheck the generated file.  Syntax errors will be indicated in the\noutput file.\n## Example compilers included\n### FlooP language from Gödel, Escher, Bach\nThe version of FlooP in this repository is differs from the book in\nseveral ways, some of which are (list is subject to change):\n- The last statement in a block does not have a semicolon\n- Variables must be declared before use\n- Comments are allowed only after procedure declarations\n- There must be a following block or statement after an `if` statement\n  (i.e. the `else` clause)\n\nA FlooP → C compiler is given in `floop.txt`.  See `floop-test.txt`\nfor an example FlooP program that prints out the prime numbers\nunder 1000. Here's another simple Floop program that produces the\noutput:\n```\nHello, world!\nCounting up to 10: 1 2 3 4 5 6 7 8 9 10 \n```\n```\ndef count (n):\n\n 'Count up from 1 to n inclusive.'\n\nbegin\n  int out;\n  out \u003c- 1;\n  loop at most n times:\n  begin\n    print out;\n    out \u003c- out + 1\n  end;\n  println ''\nend\n\nmain\nbegin\n  println 'Hello, world!';\n  print 'Counting up to 10: ';\n  do count(10)\nend\n```\nGenerated C code:\n```c\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\n\nint count(int n) {\n  int out = 0;\n  do {\n    out = 1;\n    for(int i = 0, f = 1; i \u003c n \u0026\u0026 f; i++) {\n      do {\n        printf(\"%d \",out);\n        out = out + 1;\n      } while (0);\n    }\n    puts(\"\");\n  } while (0);\n}\nint main(void) {\n  do {\n    puts(\"Hello, world!\");\n    printf(\"Counting up to 10: \");\n    count(10);\n  } while (0);\n}\n```\n### Convert infix to postfix\nInput:\n```\n29 * 19293 - 129 + (992 * 30 - 10) - (15 * (-15 + 34 * (182 + 3 - 4)) + 382) * 3 + (102 + 239 * 314) - 222\n```\nOutput:\n```\n29 19293 * 129 - 992 30 * 10 - + 15 -15 34 182 3 + 4 - * + * 382 + 3 * - 102 239 314 * + + 222 - \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiraben%2Fmeta-yacc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiraben%2Fmeta-yacc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiraben%2Fmeta-yacc/lists"}