{"id":15473487,"url":"https://github.com/seluj78/shellgrammargenerator","last_synced_at":"2026-04-19T01:01:56.790Z","repository":{"id":118616009,"uuid":"92719533","full_name":"Seluj78/ShellGrammarGenerator","owner":"Seluj78","description":"This shell script converts .yacc files into a parser friendly C file","archived":false,"fork":false,"pushed_at":"2017-10-09T11:26:58.000Z","size":195,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-25T17:45:17.832Z","etag":null,"topics":["c","shell","shell-script","yacc"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Seluj78.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-05-29T08:10:09.000Z","updated_at":"2020-10-19T19:38:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3efe4d2-5891-4e9f-bf7c-5eaef867dbc2","html_url":"https://github.com/Seluj78/ShellGrammarGenerator","commit_stats":{"total_commits":99,"total_committers":2,"mean_commits":49.5,"dds":"0.36363636363636365","last_synced_commit":"517224e5ffc472e8c3b891084b475f38ecbe2076"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Seluj78/ShellGrammarGenerator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seluj78%2FShellGrammarGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seluj78%2FShellGrammarGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seluj78%2FShellGrammarGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seluj78%2FShellGrammarGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Seluj78","download_url":"https://codeload.github.com/Seluj78/ShellGrammarGenerator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seluj78%2FShellGrammarGenerator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31990577,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"ssl_error","status_checked_at":"2026-04-18T20:23:29.375Z","response_time":103,"last_error":"SSL_read: 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":["c","shell","shell-script","yacc"],"created_at":"2024-10-02T02:54:01.973Z","updated_at":"2026-04-19T01:01:56.763Z","avatar_url":"https://github.com/Seluj78.png","language":"Shell","readme":"# ShellGrammarGenerator (SGG for short)\n\n### This script converts a yacc file into a 3D array and a header file for a modular C parser\n\n#### SGG Usage example:\n\n[![asciicast](https://asciinema.org/a/65nymkq3pw2n61v354kz2ezo6.png)](https://asciinema.org/a/65nymkq3pw2n61v354kz2ezo6)\n\n#### Usage:\n\n```bash\n-i --input  (required), used to specify the grammar file (in yacc format). If not set, will display an error\n-o --output (optional), if not set, grammar_converter will output into grammar.c and grammar.h files\n-h --help   (help) Will display help\n```\n\n\n#### Examples:\nThese two lines here are two ways to call the grammar converter\n```bash\nbash ShellGrammarGenerator.sh -i \u003cGRAMMAR_FILE\u003e -o \u003cOUTPUT_FILE\u003e\n./ShellGrammarGenerator.sh --input \u003cGRAMMAR_FILE\u003e --output \u003cOUTPOUT_FILE\u003e\n```\n\nA grammar.yacc example file can be found [here](examples/grammar.yacc.example)\n\n#### Writing a .yacc file for SGG\n\n##### % Required:\n\nEvery `%` is on its own line. Example:\n```bash\n%token XXX\n%token YYY\n```\nIs correct\n\n```bash\n%token XXX YYY\n%token XXX %token YYY\n```\nIsn't correct\n\n\nThe configuration `%token` and `%tokentemplate` are made to replace easily tokens with a template for your enum\n```bash\n%token WORD\n\n%tokentemplate E_TOKEN_\n\n//Given this:\nXXX XXX XXX WORD XXX\n\n//Will result in this:\n\nXXX XXX XXX E_TOKEN_WORD XXX\n```\n\nIf you decide not to use `%token`, you need to also remove the `%tokentemplate` line\n\nThe `%fileincludename` is required to generate a header file to go along with your 3D array generated by SGG\n```bash\n%fileincludename XXX\n```\nWhich will give the name for the header file generated.\n\nExample:\n```bash\n%fileincludename header\n```\nWill generate a file named\n`header.h`\n\nThe `%include` configuration is optional. It will add the include you want in the .c file generated\n\nExample:\n```bash\n%include parser/parser.h\n%include stdio.h\n```\nWill add these includes:\n```objectivec\n#include \u003cparser/parser.h\u003e\n#include \u003cstdio.h\u003e\n```\n\nIf you dont want any include in the .c file, just place this :\n```bash\n%include\n```\nAnd SGG won't add any includes.\n\nYou also need to specify the start of the program like this:\n```bash\n%start XXX\n```\nWith XXX being the first token in the 3D array\n\nthen you specify the end of the generator options by placing this:\nEverything before %% in the grammar file is configuration\n```bash\n%%\n```\n\n#### Contributing\n\nI'm far from being a shell/C expert and suspect there are many ways to improve this converter– if you have ideas on how to make the ShellGrammarConverter easier to maintain (and faster), don't hesitate to fork and send pull requests!\n\nYou can also take a look through the open issues and help where you can.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseluj78%2Fshellgrammargenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseluj78%2Fshellgrammargenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseluj78%2Fshellgrammargenerator/lists"}