{"id":22930396,"url":"https://github.com/usethesource/clair","last_synced_at":"2025-07-06T20:38:07.411Z","repository":{"id":37456539,"uuid":"67205774","full_name":"usethesource/clair","owner":"usethesource","description":"C Language Analysis in Rascal ","archived":false,"fork":false,"pushed_at":"2025-05-10T18:51:37.000Z","size":1188,"stargazers_count":26,"open_issues_count":29,"forks_count":12,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-10T19:33:24.560Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usethesource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.md","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-09-02T08:36:02.000Z","updated_at":"2025-05-10T18:51:38.000Z","dependencies_parsed_at":"2023-10-15T03:26:27.481Z","dependency_job_id":"ef76ea17-8122-4523-b802-0a516e982bb9","html_url":"https://github.com/usethesource/clair","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/usethesource/clair","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usethesource%2Fclair","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usethesource%2Fclair/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usethesource%2Fclair/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usethesource%2Fclair/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usethesource","download_url":"https://codeload.github.com/usethesource/clair/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usethesource%2Fclair/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260148286,"owners_count":22965910,"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-12-14T10:27:53.598Z","updated_at":"2025-06-16T11:06:26.740Z","avatar_url":"https://github.com/usethesource.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ClaiR - C Language Analysis in Rascal\n\nClaiR provides a mapping from the Eclipse CDT open C and C++ front-end to a Rascal M3 model for further processing.\nIt can work with and without working from inside the Eclipse IDE.\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.891122.svg)](https://doi.org/10.5281/zenodo.891122)\n\n## Required software\n\nYou need Rascal, and either Eclipse or VScode or the standalone Rascal jar:\n* Eclipse 2019-06 or higher with or without the CDT tools (see [here](https://www.eclipse.org/downloads/packages/release/2019-06/r/eclipse-ide-cc-developers)). With the CDT tools you have some more tools to access information from CPP projects (like include paths), but otherwise Clair functions the same.\n  * In Eclipse, install the Rascal plugin from the update site: \u003chttps://update.rascal-mpl.org/stable/\u003e\n* Or: VScode with the Rascal extension \n   * Use the extension view in VScode to install Rascal\n* Or: the Rascal commandline (see [here](https://www.rascal-mpl.org/start/))\n\n\n## How to use ClaiR once you have Rascal installed:\n\n* Create an empty project \"myproject\" in a folder named \"myproject\" using the `newRascalProject` function from `util::Reflective`.\n* In `pom.xml` add:\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.rascalmpl\u003c/groupId\u003e\n    \u003cartifactId\u003eclair\u003c/artifactId\u003e\n    \u003cversion\u003e0.6.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n* In `META-INF/RASCAL.MF` add:\n```\nRequire-libraries: |lib://clair|\n```\n* And (optionally) add in `pom.xml` this to be able to run `mvn rascal:console` and the Rascal compiler:\n```\n\u003cplugins\u003e\n    \u003cplugin\u003e\n        \u003cgroupId\u003eorg.rascalmpl\u003c/groupId\u003e\n        \u003cartifactId\u003erascal-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e0.7.3\u003c/version\u003e\n        \u003cconfiguration\u003e\n            \u003cbin\u003e${project.build.outputDirectory}\u003c/bin\u003e\n            \u003csrcs\u003e\n                \u003csrc\u003e${project.basedir}/src\u003c/src\u003e\n            \u003c/srcs\u003e\n        \u003c/configuration\u003e\n        \u003cexecutions\u003e\n            \u003cexecution\u003e\n                \u003cid\u003erascal-compile\u003c/id\u003e\n                \u003cphase\u003ecompile\u003c/phase\u003e\n                \u003cgoals\u003e\n                    \u003cgoal\u003ecompile\u003c/goal\u003e\n                \u003c/goals\u003e\n            \u003c/execution\u003e\n            \u003cexecution\u003e\n                \u003cid\u003erascal-package\u003c/id\u003e\n                \u003cphase\u003epre-package\u003c/phase\u003e\n                \u003cgoals\u003e\n                    \u003cgoal\u003epackage\u003c/goal\u003e\n                \u003c/goals\u003e\n            \u003c/execution\u003e\n        \u003c/executions\u003e\n    \u003c/plugin\u003e\n\u003c/plugins\u003e\n\n```\n* note to skip running the Rascal compiler: `mvn compile -Drascal.compile.skip`\n\n## How to run\n* On the commandline, in your own project, run `mvn rascal:console`, or\n* In Eclipse's Project Explorer, right click a project's folder and select *Rascal Console*. The console should open inside Eclipse's terminal window with the title \"Rascal [**project: \u003cProject Name\u003e**, mode: debug]\". If, instead, it shows \"project: none\", make sure you clicked the project and the project is actually open.\n* Or in VScode start a Rascal terminal from the command pallette while having an editor for a Rascal module of your project open, or from the \"Import in new Rascal terminal\" action in a Rascal editor.\n* Import ClaiR into the console by running `import lang::cpp::AST;`.\n* To parse a string containing source code, call the `parseString` function, e.g., `parseString(\"int foo() { return 0; }\")`.\n* To parse source files on disk, call the `parseCpp` function with a source location, e.g., `parseCpp(|file:///tmp/example.cpp|)`, `parseCpp(|project://clair/src/test/test.cpp|)`, `parseCpp(|home://myFile.cpp|)`, or `parseCpp(|file://C:/My%20Dir/main.cpp|)`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusethesource%2Fclair","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusethesource%2Fclair","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusethesource%2Fclair/lists"}