{"id":16698015,"url":"https://github.com/arlac77/pratt-parser","last_synced_at":"2026-03-09T11:33:18.444Z","repository":{"id":1626687,"uuid":"41563615","full_name":"arlac77/pratt-parser","owner":"arlac77","description":"TDOP parser https://tdop.github.io","archived":false,"fork":false,"pushed_at":"2026-02-28T22:40:27.000Z","size":3085,"stargazers_count":17,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-01T01:41:45.116Z","etag":null,"topics":["javascript","pratt-parser"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arlac77.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":"2015-08-28T18:51:51.000Z","updated_at":"2026-02-28T22:40:30.000Z","dependencies_parsed_at":"2025-12-04T03:04:54.283Z","dependency_job_id":null,"html_url":"https://github.com/arlac77/pratt-parser","commit_stats":{"total_commits":1923,"total_committers":7,"mean_commits":274.7142857142857,"dds":"0.22776911076443063","last_synced_commit":"3d1c7150d833601e64eb311093b847e3d6ec0330"},"previous_names":[],"tags_count":101,"template":false,"template_full_name":null,"purl":"pkg:github/arlac77/pratt-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fpratt-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fpratt-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fpratt-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fpratt-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arlac77","download_url":"https://codeload.github.com/arlac77/pratt-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fpratt-parser/sbom","scorecard":{"id":207384,"data":{"date":"2025-08-11","repo":{"name":"github.com/arlac77/pratt-parser","commit":"f3ad74157450a25129f9c6ede79b2e4aa9344355"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/9 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/pr_labeler.yml:6","Warn: no topLevel permission defined: .github/workflows/auto_approve.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/ci.yml:12","Warn: no topLevel permission defined: .github/workflows/codeql_analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/pr_labeler.yml:1","Warn: no topLevel permission defined: .github/workflows/update_package_lock.yml:1","Warn: no topLevel permission defined: .github/workflows/update_readme_api.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/auto_approve.yml:7: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/auto_approve.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:78: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:80: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:99: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql_analysis.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/codeql_analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql_analysis.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/codeql_analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql_analysis.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/codeql_analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql_analysis.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/codeql_analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr_labeler.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/pr_labeler.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update_package_lock.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/update_package_lock.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update_package_lock.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/update_package_lock.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/update_package_lock.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/update_package_lock.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update_readme_api.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/update_readme_api.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update_readme_api.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/update_readme_api.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/update_readme_api.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/arlac77/pratt-parser/update_readme_api.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/update_package_lock.yml:30","Info:   0 out of  15 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   5 out of   6 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD Zero Clause License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/ci.yml:66"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":8,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 19 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-g3ch-rx76-35fx"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T00:04:53.555Z","repository_id":1626687,"created_at":"2025-08-17T00:04:53.555Z","updated_at":"2025-08-17T00:04:53.555Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30292473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T11:12:22.024Z","status":"ssl_error","status_checked_at":"2026-03-09T11:10:54.577Z","response_time":61,"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":["javascript","pratt-parser"],"created_at":"2024-10-12T17:50:20.947Z","updated_at":"2026-03-09T11:33:18.424Z","avatar_url":"https://github.com/arlac77.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/pratt-parser.svg)](https://www.npmjs.com/package/pratt-parser)\n[![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)\n[![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\\\u0026label\\\u0026labelColor=blue\\\u0026color=555555)](https://typescriptlang.org)\n[![bundlejs](https://deno.bundlejs.com/?q=pratt-parser\\\u0026badge=detailed)](https://bundlejs.com/?q=pratt-parser)\n[![downloads](http://img.shields.io/npm/dm/pratt-parser.svg?style=flat-square)](https://npmjs.org/package/pratt-parser)\n[![GitHub Issues](https://img.shields.io/github/issues/arlac77/pratt-parser.svg?style=flat-square)](https://github.com/arlac77/pratt-parser/issues)\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Farlac77%2Fpratt-parser%2Fbadge\\\u0026style=flat)](https://actions-badge.atrox.dev/arlac77/pratt-parser/goto)\n[![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Known Vulnerabilities](https://snyk.io/test/github/arlac77/pratt-parser/badge.svg)](https://snyk.io/test/github/arlac77/pratt-parser)\n[![Coverage Status](https://coveralls.io/repos/arlac77/pratt-parser/badge.svg)](https://coveralls.io/github/arlac77/pratt-parser)\n\n# pratt-parser\n\nPratt Parser\n\nBased on\n[Top Down Operator Precedence](https://tdop.github.io) and\n[Douglas Crockford TDOP](https://github.com/douglascrockford/TDOP)\n\n\u003c!-- skip-example --\u003e\n\n```javascript\nimport { Parser, WhiteSpaceToken, NumberToken } from \"pratt-parser\";\n\nfunction Value(value) {\n  return Object.create(null, {\n    value: {\n      value: value\n    }\n  });\n}\n\nconst myGrammar = new Parser({\n  tokens: [WhiteSpaceToken, NumberToken],\n  prefix: {\n    \"(\": {\n      nud(grammar) {\n        const e = grammar.expression(0);\n        grammar.advance(\")\");\n        return e;\n      }\n    }\n  },\n  infix: {\n    \")\": {},\n    \"+\": {\n      precedence: 50,\n      combine: (left, right) =\u003e Value(left.value + right.value)\n    },\n    \"-\": {\n      precedence: 50,\n      combine: (left, right) =\u003e Value(left.value - right.value)\n    },\n    \"*\": {\n      precedence: 60,\n      combine: (left, right) =\u003e Value(left.value * right.value)\n    },\n    \"/\": {\n      precedence: 60,\n      combine: (left, right) =\u003e Value(left.value / right.value)\n    }\n  }\n});\n\nconsole.log(myGrammar.parse(\"(1 + (1 + 4 * 3)) * (2 + 1)\").value);\n```\n\n# API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### Table of Contents\n\n*   [ParsePosition](#parseposition)\n    *   [Properties](#properties)\n*   [Token](#token)\n    *   [Properties](#properties-1)\n*   [RootToken](#roottoken)\n    *   [parse](#parse)\n        *   [Parameters](#parameters)\n*   [WhiteSpaceToken](#whitespacetoken)\n*   [LineCommentToken](#linecommenttoken)\n*   [EOFToken](#eoftoken)\n*   [Parser](#parser)\n    *   [Parameters](#parameters-1)\n    *   [error](#error)\n        *   [Parameters](#parameters-2)\n    *   [parse](#parse-1)\n        *   [Parameters](#parameters-3)\n*   [Tokenizer](#tokenizer)\n    *   [Parameters](#parameters-4)\n    *   [tokens](#tokens)\n        *   [Parameters](#parameters-5)\n    *   [error](#error-1)\n        *   [Parameters](#parameters-6)\n\n## ParsePosition\n\nType: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\n### Properties\n\n*   `offset` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n*   `chunk` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n\n## Token\n\nType: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\n### Properties\n\n*   `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n*   `precedence` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n*   `value` **any**\u0026#x20;\n\n## RootToken\n\nBase object for all tokens\n\n### parse\n\nParses from chunk of PrasePosition and delivers next token\nModifies ParsePosition so that it points behind the detected token.\n\n#### Parameters\n\n*   `pp` **[ParsePosition](#parseposition)**\u0026#x20;\n\nReturns **[Token](#token)**\u0026#x20;\n\n## WhiteSpaceToken\n\nskip white space\n\n## LineCommentToken\n\nskips until end of line\n\n## EOFToken\n\nToken representing 'end of file'\n\n## Parser\n\nCreates a grammar for later parsing\n\n### Parameters\n\n*   `grammar` **any**\u0026#x20;\n*   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**\u0026#x20;\n\n### error\n\nForwards error to the tokenizer\n\n#### Parameters\n\n*   `args` **...any**\u0026#x20;\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** error\n\n### parse\n\nParses the input and delivers the outermoost expression.\n\n#### Parameters\n\n*   `chunk` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** input text\n*   `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** object transparently passed to tokenizer\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** evaluated input\n\n## Tokenizer\n\nCreates a tokenizer for later parsing.\n\n### Parameters\n\n*   `grammar` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** definition of the grammar with operators...\n\n### tokens\n\nDelivers tokens from the input.\n\n#### Parameters\n\n*   `chunk` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the input to be processed\n*   `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** additional info to be used by the actual token types\n\n### error\n\n#### Parameters\n\n*   `message` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**\u0026#x20;\n*   `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** token initiating the error\n*   `value` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**\u0026#x20;\n\nReturns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** error\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```shell\nnpm install pratt-parser\n```\n\n# license\n\nBSD-2-Clause\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farlac77%2Fpratt-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farlac77%2Fpratt-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farlac77%2Fpratt-parser/lists"}