{"id":17040902,"url":"https://github.com/m4gnv5/cparse","last_synced_at":"2025-04-12T14:32:58.643Z","repository":{"id":80537205,"uuid":"49971314","full_name":"M4GNV5/cparse","owner":"M4GNV5","description":"C parser in pure JavaScript","archived":false,"fork":false,"pushed_at":"2020-12-06T18:02:08.000Z","size":24,"stargazers_count":49,"open_issues_count":0,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T09:04:33.643Z","etag":null,"topics":["c","javascript","lexer","parser"],"latest_commit_sha":null,"homepage":"https://m4gnv5.github.io/cparse/demo/","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/M4GNV5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-19T17:50:03.000Z","updated_at":"2025-03-25T18:59:35.000Z","dependencies_parsed_at":"2023-03-12T11:23:05.021Z","dependency_job_id":null,"html_url":"https://github.com/M4GNV5/cparse","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4GNV5%2Fcparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4GNV5%2Fcparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4GNV5%2Fcparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4GNV5%2Fcparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/M4GNV5","download_url":"https://codeload.github.com/M4GNV5/cparse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248581228,"owners_count":21128127,"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":["c","javascript","lexer","parser"],"created_at":"2024-10-14T09:10:49.932Z","updated_at":"2025-04-12T14:32:58.615Z","avatar_url":"https://github.com/M4GNV5.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cparse\nC parser in pure JavaScript\n\n## Installation\n\n`TODO put this on npm`\n\n## Usage\n\n### CommonJS\n```javascript\nvar cparse = require('./cparse.js');\nvar ast = cparse(\"void main() { int answer = 6 * 7; }\");\nconsole.log(JSON.stringify(ast, undefined, 4));\n```\n\n### Browser\n```html\n\u003cscript src=\"cparse.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nvar ast = cparse(\"void main() { int answer = 6 * 7; }\");\nconsole.log(JSON.stringify(ast, undefined, 4));\n\u003c/script\u003e\n```\n\n## AST Format\nParsing code:\n```C\nint answer = 6 * 7;\n```\n\noutputs following AST (the positions of each AST entry have been removed to reduce size):\n```JSON\n[\n    {\n        \"type\": \"GlobalVariableDeclaration\",\n        \"defType\": {\n            \"type\": \"Type\",\n            \"modifier\": [],\n            \"name\": \"int\"\n        },\n        \"name\": \"answer\",\n        \"value\": {\n            \"type\": \"BinaryExpression\",\n            \"operator\": \"*\",\n            \"left\": {\n                \"type\": \"Literal\",\n                \"value\": 6,\n            },\n            \"right\": {\n                \"type\": \"Literal\",\n                \"value\": 7,\n            },\n        }\n    }\n]\n```\n\n## License\n```\n\"THE BEER-WARE LICENSE\":\n\nJakob Löw \u003cjakob@m4gnus.de\u003e wrote this code. As long as you retain this notice you\ncan do whatever you want with this stuff. If we meet some day, and you think\nthis stuff is worth it, you can buy me a beer in return.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4gnv5%2Fcparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm4gnv5%2Fcparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4gnv5%2Fcparse/lists"}