{"id":13645413,"url":"https://github.com/MikePopoloski/slang","last_synced_at":"2025-04-21T14:30:59.379Z","repository":{"id":37550094,"uuid":"80874333","full_name":"MikePopoloski/slang","owner":"MikePopoloski","description":"SystemVerilog compiler and language services","archived":false,"fork":false,"pushed_at":"2024-05-19T19:36:08.000Z","size":30790,"stargazers_count":547,"open_issues_count":38,"forks_count":114,"subscribers_count":30,"default_branch":"master","last_synced_at":"2024-05-20T01:47:58.441Z","etag":null,"topics":["compiler","language-service","parse","slang","systemverilog","verilog"],"latest_commit_sha":null,"homepage":"","language":"C++","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/MikePopoloski.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-02-03T22:20:21.000Z","updated_at":"2024-05-27T12:51:25.216Z","dependencies_parsed_at":"2023-10-24T13:34:42.219Z","dependency_job_id":"f36cb901-7cdc-4739-ae04-0758e987ff12","html_url":"https://github.com/MikePopoloski/slang","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikePopoloski%2Fslang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikePopoloski%2Fslang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikePopoloski%2Fslang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikePopoloski%2Fslang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikePopoloski","download_url":"https://codeload.github.com/MikePopoloski/slang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223564747,"owners_count":17165988,"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":["compiler","language-service","parse","slang","systemverilog","verilog"],"created_at":"2024-08-02T01:02:34.701Z","updated_at":"2025-04-21T14:30:59.370Z","avatar_url":"https://github.com/MikePopoloski.png","language":"C++","funding_links":[],"categories":["C++","HDL parsers","Circuit Compilers"],"sub_categories":[],"readme":"slang - SystemVerilog Language Services\n=======================================\n![](https://github.com/MikePopoloski/slang/workflows/CI%20Build/badge.svg)\n[![codecov](https://codecov.io/gh/MikePopoloski/slang/branch/master/graph/badge.svg)](https://codecov.io/gh/MikePopoloski/slang)\n[![PyPI](https://img.shields.io/pypi/v/pyslang.svg)](https://pypi.org/project/pyslang/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/MikePopoloski/slang/blob/master/LICENSE)\n\nslang is a software library that provides various components for lexing, parsing, type checking, and elaborating SystemVerilog code. It comes with an executable tool that can compile and lint any SystemVerilog project, but it is also intended to be usable as a front end for synthesis tools, simulators, linters, code editors, and refactoring tools.\n\nslang is the fastest and most compliant SystemVerilog frontend (according to the open source [chipsalliance test suite](https://github.com/chipsalliance/sv-tests)).\n\nFull documentation is available on the website: https://sv-lang.com\n\n### Features\n-   Fully parse, analyze, and elaborate all SystemVerilog features - see [this page](https://sv-lang.com/language-support.html) for current status.\n-   Be robust about compilation, no matter how broken the source text. This makes the compiler usable in editor highlighting and completion scenarios, where the code is likely to be broken because the user is still writing it.\n-   The parse tree should round trip back to the original source, making it easy to write refactoring and code generation tools.\n-   Provide great error messages, ala clang.\n-   Be fast and robust in the face of production-scale projects.\n\n### Use Cases\nSome examples of things you can use slang for:\n-   Very fast syntax checking and linting tool\n-   Dumping the AST of your project to JSON\n-   Source code introspection via included Python bindings\n-   SystemVerilog code generation and refactoring\n-   As the engine for an editor language server\n-   As a fast and robust preprocessor that sits in front of downstream tools\n-   As a frontend for a synthesis or simulation tool, by including slang as a library\n\n### Getting Started\n\nInstructions on building slang from source are [here](https://sv-lang.com/building.html). The tl;dr is:\n```\ngit clone https://github.com/MikePopoloski/slang.git\ncd slang\ncmake -B build\ncmake --build build -j\n```\n\nThe slang binary can be run on your code right out of the box; check out the [user manual](https://sv-lang.com/user-manual.html) for more information about how it works.\n\nIf you're looking to use slang as a library, please read through the [developer guide](https://sv-lang.com/developer-guide.html).\n\n### Try It Out\n\nExperiment with parsing, type checking, and error detection live [on the web](https://sv-lang.com/explore/) (inspired by Matt Godbolt's excellent [Compiler Explorer](https://godbolt.org/)).\n\n### Python Bindings\n\nThis project also includes Python bindings for the library, which can be installed via PyPI:\n```\npip install pyslang\n```\nor, to update your installed version to the latest release:\n```\npip install -U pyslang\n```\nor, to checkout and install a local build:\n```\ngit clone https://github.com/MikePopoloski/slang.git\ncd slang\npip install .\n```\n\n#### Example Python Usage\n\nGiven a 'test.sv' source file:\n```sv\nmodule memory(\n    address,\n    data_in,\n    data_out,\n    read_write,\n    chip_en\n  );\n\n  input wire [7:0] address, data_in;\n  output reg [7:0] data_out;\n  input wire read_write, chip_en;\n\n  reg [7:0] mem [0:255];\n\n  always @ (address or data_in or read_write or chip_en)\n    if (read_write == 1 \u0026\u0026 chip_en == 1) begin\n      mem[address] = data_in;\n  end\n\n  always @ (read_write or chip_en or address)\n    if (read_write == 0 \u0026\u0026 chip_en)\n      data_out = mem[address];\n    else\n      data_out = 0;\n\nendmodule\n```\n\nWe can use slang to load the syntax tree and inspect it:\n```py\nimport pyslang\n\ntree = pyslang.SyntaxTree.fromFile('test.sv')\nmod = tree.root.members[0]\nprint(mod.header.name.value)\nprint(mod.members[0].kind)\nprint(mod.members[1].header.dataType)\n```\n\n```\nmemory\nSyntaxKind.PortDeclaration\nreg [7:0]\n```\n\nWe can also evaluate arbitrary SystemVerilog expressions:\n```py\nsession = pyslang.ScriptSession()\nsession.eval(\"logic bit_arr [16] = '{0:1, 1:1, 2:1, default:0};\")\nresult = session.eval(\"bit_arr.sum with ( int'(item) );\")\nprint(result)\n```\n\n```\n3\n```\n\n### Contact \u0026 Support\n\nIf you encounter a bug, have questions, or want to contribute, please get in touch by opening a GitHub issue or discussion thread.\n\nContributions are welcome, whether they be in the form of bug reports, comments, suggestions, documentation improvements, or full fledged new features via pull requests.\n\n### License\n\nslang is licensed under the MIT license:\n\n\u003e   Copyright (c) 2015-2025 Michael Popoloski\n\u003e\n\u003e   Permission is hereby granted, free of charge, to any person obtaining a copy\n\u003e   of this software and associated documentation files (the \"Software\"), to deal\n\u003e   in the Software without restriction, including without limitation the rights\n\u003e   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\u003e   copies of the Software, and to permit persons to whom the Software is\n\u003e   furnished to do so, subject to the following conditions:\n\u003e\n\u003e   The above copyright notice and this permission notice shall be included in\n\u003e   all copies or substantial portions of the Software.\n\u003e\n\u003e   THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\u003e   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\u003e   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\u003e   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\u003e   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\u003e   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\u003e   THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMikePopoloski%2Fslang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMikePopoloski%2Fslang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMikePopoloski%2Fslang/lists"}