{"id":13394773,"url":"https://github.com/zaach/jison","last_synced_at":"2025-05-13T18:13:06.981Z","repository":{"id":740410,"uuid":"391150","full_name":"zaach/jison","owner":"zaach","description":"Bison in JavaScript.","archived":false,"fork":false,"pushed_at":"2022-10-14T08:26:50.000Z","size":2806,"stargazers_count":4368,"open_issues_count":161,"forks_count":453,"subscribers_count":107,"default_branch":"master","last_synced_at":"2025-04-25T17:51:24.989Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://jison.org","language":"JavaScript","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/zaach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-12-01T05:34:08.000Z","updated_at":"2025-04-17T12:17:59.000Z","dependencies_parsed_at":"2022-08-16T10:45:25.340Z","dependency_job_id":null,"html_url":"https://github.com/zaach/jison","commit_stats":null,"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaach%2Fjison","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaach%2Fjison/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaach%2Fjison/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaach%2Fjison/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zaach","download_url":"https://codeload.github.com/zaach/jison/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254000883,"owners_count":21997443,"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":[],"created_at":"2024-07-30T17:01:31.076Z","updated_at":"2025-05-13T18:13:06.956Z","avatar_url":"https://github.com/zaach.png","language":"JavaScript","readme":"Jison\n=====\n* [issues](http://github.com/zaach/jison/issues)\n* [discuss](mailto:jison@librelist.com)\n\n[![build status](https://travis-ci.org/zaach/jison.svg)](http://travis-ci.org/zaach/jison)\n\nAn API for creating parsers in JavaScript\n-----------------------------------------\n\nJison generates bottom-up parsers in JavaScript. Its API is similar to Bison's, hence the name. It supports many of Bison's major features, plus some of its own. If you are new to parser generators such as Bison, and Context-free Grammars in general, a [good introduction][1] is found in the Bison manual. If you already know Bison, Jison should be easy to pickup.\n\nBriefly, Jison takes a JSON encoded grammar or Bison style grammar and outputs a JavaScript file capable of parsing the language described by that grammar. You can then use the generated script to parse inputs and accept, reject, or perform actions based on the input.\n\nInstallation\n------------\nJison can be installed for [Node](http://nodejs.org) using [`npm`](http://github.com/isaacs/npm/)\n\nUsing npm:\n\n    npm install jison -g\n\nUsage from the command line\n-----------------------\n\nClone the github repository for examples:\n\n    git clone git://github.com/zaach/jison.git\n    cd jison/examples\n\nNow you're ready to generate some parsers:\n\n    jison calculator.jison\n\nThis will generate `calculator.js` in your current working directory. This file can be used to parse an input file, like so:\n\n    echo \"2^32 / 1024\" \u003e testcalc\n    node calculator.js testcalc\n\nThis will print out `4194304`.\n\nFull cli option list:\n\n    Usage: jison [file] [lexfile] [options]\n\n    file        file containing a grammar\n    lexfile     file containing a lexical grammar\n\n    Options:\n       -j, --json                    force jison to expect a grammar in JSON format\n       -o FILE, --outfile FILE       Filename and base module name of the generated parser\n       -t, --debug                   Debug mode\n       -m TYPE, --module-type TYPE   The type of module to generate (commonjs, amd, js)\n       -p TYPE, --parser-type TYPE   The type of algorithm to use for the parser (lr0, slr, lalr, lr)\n       -V, --version                 print version and exit\n\n\nUsage from a CommonJS module\n--------------------------\n\nYou can generate parsers programatically from JavaScript as well. Assuming Jison is in your commonjs environment's load path:\n\n```javascript\n// mygenerator.js\nvar Parser = require(\"jison\").Parser;\n\n// a grammar in JSON\nvar grammar = {\n    \"lex\": {\n        \"rules\": [\n           [\"\\\\s+\", \"/* skip whitespace */\"],\n           [\"[a-f0-9]+\", \"return 'HEX';\"]\n        ]\n    },\n\n    \"bnf\": {\n        \"hex_strings\" :[ \"hex_strings HEX\",\n                         \"HEX\" ]\n    }\n};\n\n// `grammar` can also be a string that uses jison's grammar format\nvar parser = new Parser(grammar);\n\n// generate source, ready to be written to disk\nvar parserSource = parser.generate();\n\n// you can also use the parser directly from memory\n\n// returns true\nparser.parse(\"adfe34bc e82a\");\n\n// throws lexical error\nparser.parse(\"adfe34bc zxg\");\n```\n\nMore Documentation\n------------------\nFor more information on creating grammars and using the generated parsers, read the [documentation](http://jison.org/docs).\n\nHow to contribute\n-----------------\n\nSee [CONTRIBUTING.md](https://github.com/zaach/jison/blob/master/CONTRIBUTING.md) for contribution guidelines, how to run the tests, etc.\n\nProjects using Jison\n------------------\n\nView them on the [wiki](https://github.com/zaach/jison/wiki/ProjectsUsingJison), or add your own.\n\n\nContributors\n------------\n[Githubbers](http://github.com/zaach/jison/contributors)\n\nSpecial thanks to Jarred Ligatti, Manuel E. Bermúdez \n\nLicense\n-------\n\n\u003e Copyright (c) 2009-2014 Zachary Carter\n\u003e \n\u003e  Permission is hereby granted, free of\n\u003e charge, to any person  obtaining a\n\u003e copy of this software and associated\n\u003e documentation  files (the \"Software\"),\n\u003e to deal in the Software without \n\u003e restriction, including without\n\u003e limitation the rights to use,  copy,\n\u003e modify, merge, publish, distribute,\n\u003e sublicense, and/or sell  copies of the\n\u003e Software, and to permit persons to\n\u003e whom the  Software is furnished to do\n\u003e so, subject to the following \n\u003e conditions:\n\u003e \n\u003e  The above copyright notice and this\n\u003e permission notice shall be  included\n\u003e in all copies or substantial portions\n\u003e of the Software.\n\u003e \n\u003e  THE SOFTWARE IS PROVIDED \"AS IS\",\n\u003e WITHOUT WARRANTY OF ANY KIND,  EXPRESS\n\u003e OR IMPLIED, INCLUDING BUT NOT LIMITED\n\u003e TO THE WARRANTIES  OF MERCHANTABILITY,\n\u003e FITNESS FOR A PARTICULAR PURPOSE AND \n\u003e NONINFRINGEMENT. IN NO EVENT SHALL THE\n\u003e AUTHORS OR COPYRIGHT  HOLDERS BE\n\u003e LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\u003e LIABILITY,  WHETHER IN AN ACTION OF\n\u003e CONTRACT, TORT OR OTHERWISE, ARISING \n\u003e FROM, OUT OF OR IN CONNECTION WITH THE\n\u003e SOFTWARE OR THE USE OR  OTHER DEALINGS\n\u003e IN THE SOFTWARE.\n\n\n  [1]: http://dinosaur.compilertools.net/bison/bison_4.html\n\n","funding_links":[],"categories":["JavaScript","Packages","包","目录","Parsing"],"sub_categories":["Parsing","解析","解析工具"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaach%2Fjison","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaach%2Fjison","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaach%2Fjison/lists"}