{"id":14111038,"url":"https://github.com/tunnelvisionlabs/antlr4ts","last_synced_at":"2026-01-14T03:25:08.487Z","repository":{"id":12820470,"uuid":"69822474","full_name":"tunnelvisionlabs/antlr4ts","owner":"tunnelvisionlabs","description":"Optimized TypeScript target for ANTLR 4","archived":false,"fork":false,"pushed_at":"2024-05-17T14:51:03.000Z","size":2659,"stargazers_count":669,"open_issues_count":124,"forks_count":106,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-10-28T07:03:33.070Z","etag":null,"topics":["antlr","antlr4","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tunnelvisionlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2016-10-02T21:13:59.000Z","updated_at":"2025-10-16T02:15:07.000Z","dependencies_parsed_at":"2024-09-23T06:31:05.163Z","dependency_job_id":"6d6daf0f-d32f-4cc9-92ed-4ef77503b4b0","html_url":"https://github.com/tunnelvisionlabs/antlr4ts","commit_stats":{"total_commits":764,"total_committers":12,"mean_commits":"63.666666666666664","dds":0.2068062827225131,"last_synced_commit":"4d58e24ff4b92366acb5b4f0c61c54306ba71e1f"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/tunnelvisionlabs/antlr4ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnelvisionlabs%2Fantlr4ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnelvisionlabs%2Fantlr4ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnelvisionlabs%2Fantlr4ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnelvisionlabs%2Fantlr4ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tunnelvisionlabs","download_url":"https://codeload.github.com/tunnelvisionlabs/antlr4ts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnelvisionlabs%2Fantlr4ts/sbom","scorecard":{"id":902425,"data":{"date":"2025-08-11","repo":{"name":"github.com/tunnelvisionlabs/antlr4ts","commit":"4d58e24ff4b92366acb5b4f0c61c54306ba71e1f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.2,"checks":[{"name":"Code-Review","score":2,"reason":"Found 2/8 approved changesets -- score normalized to 2","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":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 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":0,"reason":"26 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-4r62-v4vq-hr96","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj"],"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-24T16:07:06.691Z","repository_id":12820470,"created_at":"2025-08-24T16:07:06.691Z","updated_at":"2025-08-24T16:07:06.691Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":["antlr","antlr4","typescript"],"created_at":"2024-08-14T10:03:06.881Z","updated_at":"2026-01-14T03:25:08.469Z","avatar_url":"https://github.com/tunnelvisionlabs.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# antlr4ts - TypeScript/JavaScript target for ANTLR 4\n\n[![Join the chat at https://gitter.im/tunnelvisionlabs/antlr4ts](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tunnelvisionlabs/antlr4ts?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n[![Build status](https://ci.appveyor.com/api/projects/status/d4gpmnrkfo3tb2t1/branch/master?svg=true)](https://ci.appveyor.com/project/sharwell/antlr4ts/branch/master)\n\n[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](./LICENSE)\n\n## Overview\n\n* **Releases:** See the [GitHub Releases](https://github.com/tunnelvisionlabs/antlr4ts/releases) page for release notes and\n  links to the distribution\n* **Feedback:** Use [GitHub Issues](https://github.com/tunnelvisionlabs/antlr4ts/issues) for issues (bugs, enhancements,\n  features, and questions)\n\n## Requirements\n\nThis project has separate requirements for developers and end users.\n\n\u003e :bulb: The requirements listed on this page only cover user scenarios - that is, scenarios where developers wish to\n\u003e use ANTLR 4 for parsing tasks inside of a TypeScript application. If you are interested in contributing to ANTLR 4\n\u003e itself, see [CONTRIBUTING.md](CONTRIBUTING.md) for contributor documentation.\n\n### End user requirements\n\nParsers generated by the ANTLR 4 TypeScript target have a runtime dependency on the\n[antlr4ts](https://www.npmjs.com/package/antlr4ts) package. The package is tested and known to work with Node.js 6.7.\n\n### Development requirements\n\nThe tool used to generate TypeScript code from an ANTLR 4 grammar is written in Java. To fully utilize the ANTLR 4\nTypeScript target (including the ability to regenerate code from a grammar file after changes are made), a Java Runtime\nEnvironment (JRE) needs to be installed on the developer machine. The generated code itself uses several features new to\nTypeScript 2.0.\n\n* Java Runtime Environment 1.6+ (1.8+ recommended)\n* TypeScript 2.0+\n\n## Getting started\n\n1. Install `antlr4ts` as a runtime dependency using your preferred package manager.\n\n  ```bash\n  npm install antlr4ts --save\n  ```\n  \n  ```bash\n  yarn add antlr4ts\n  ```\n\n2. Install `antlr4ts-cli` as a development dependency using your preferred package manager.\n\n  ```bash\n  npm install antlr4ts-cli --save-dev\n  ```\n  \n  ```bash\n  yarn add -D antlr4ts-cli\n  ```\n\n3. Add a grammar to your project, e.g. **path/to/MyGrammar.g4**\n\n4. Add a script to **package.json** for compiling your grammar to TypeScript\n\n    ```\n    \"scripts\": {\n      // ...\n      \"antlr4ts\": \"antlr4ts -visitor path/to/MyGrammar.g4\"\n    }\n    ```\n\n5. Use your grammar in TypeScript\n\n    ```typescript\n    import { ANTLRInputStream, CommonTokenStream } from 'antlr4ts';\n\n    // Create the lexer and parser\n    let inputStream = new ANTLRInputStream(\"text\");\n    let lexer = new MyGrammarLexer(inputStream);\n    let tokenStream = new CommonTokenStream(lexer);\n    let parser = new MyGrammarParser(tokenStream);\n\n    // Parse the input, where `compilationUnit` is whatever entry point you defined\n    let tree = parser.compilationUnit();\n    ```\n\n    The two main ways to inspect the tree are by using a listener or a visitor, you can read about the differences between the two [here](https://github.com/antlr/antlr4/blob/master/doc/listeners.md).\n\n    ###### Listener Approach\n\n    ```typescript\n    // ...\n    import { MyGrammarParserListener } from './MyGrammarParserListener'\n    import { FunctionDeclarationContext } from './MyGrammarParser'\n    import { ParseTreeWalker } from 'antlr4ts/tree/ParseTreeWalker'\n\n\n    class EnterFunctionListener implements MyGrammarParserListener {\n      // Assuming a parser rule with name: `functionDeclaration`\n      enterFunctionDeclaration(context: FunctionDeclarationContext) {\n        console.log(`Function start line number ${context._start.line}`)\n        // ...\n      }\n\n      // other enterX functions...\n    }\n\n    // Create the listener\n    const listener: MyGrammarParserListener = new EnterFunctionListener();\n    // Use the entry point for listeners\n    ParseTreeWalker.DEFAULT.walk(listener, tree)\n    ```\n\n    ###### Visitor Approach\n\n    Note you must pass the `-visitor` flag to antlr4ts to get the generated visitor file.\n\n    ```typescript\n    // ...\n    import { MyGrammarParserVisitor } from './MyGrammarParserVisitor'\n    import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'\n\n    // Extend the AbstractParseTreeVisitor to get default visitor behaviour\n    class CountFunctionsVisitor extends AbstractParseTreeVisitor\u003cnumber\u003e implements MyGrammarParserVisitor\u003cnumber\u003e {\n\n      defaultResult() {\n        return 0\n      }\n\n      aggregateResult(aggregate: number, nextResult: number) {\n        return aggregate + nextResult\n      }\n\n      visitFunctionDeclaration(context: FunctionDeclarationContext): number {\n        return 1 + super.visitChildren(context)\n      }\n    }\n\n    // Create the visitor\n    const countFunctionsVisitor = new CountFunctionsVisitor()\n    // Use the visitor entry point\n    countFunctionsVisitor.visit(tree)\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftunnelvisionlabs%2Fantlr4ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftunnelvisionlabs%2Fantlr4ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftunnelvisionlabs%2Fantlr4ts/lists"}