{"id":13995971,"url":"https://github.com/vlang/c2v","last_synced_at":"2026-02-09T03:04:07.076Z","repository":{"id":37973872,"uuid":"192447269","full_name":"vlang/c2v","owner":"vlang","description":"C/C++ to V translator","archived":false,"fork":false,"pushed_at":"2026-02-04T09:19:26.000Z","size":309,"stargazers_count":251,"open_issues_count":75,"forks_count":35,"subscribers_count":33,"default_branch":"master","last_synced_at":"2026-02-04T20:45:26.977Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"V","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vlang.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":"2019-06-18T02:01:34.000Z","updated_at":"2026-02-04T09:19:29.000Z","dependencies_parsed_at":"2024-02-11T02:25:40.783Z","dependency_job_id":"a649d4c7-cfac-4aa5-a422-9adc87d04146","html_url":"https://github.com/vlang/c2v","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vlang/c2v","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlang%2Fc2v","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlang%2Fc2v/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlang%2Fc2v/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlang%2Fc2v/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vlang","download_url":"https://codeload.github.com/vlang/c2v/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlang%2Fc2v/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29255393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T01:52:29.835Z","status":"online","status_checked_at":"2026-02-09T02:00:09.501Z","response_time":56,"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":[],"created_at":"2024-08-09T14:03:42.553Z","updated_at":"2026-02-09T03:04:07.071Z","avatar_url":"https://github.com/vlang.png","language":"V","funding_links":[],"categories":["V"],"sub_categories":[],"readme":"## C2V\n\nC =\u003e V source code translator.\n\nDemo Video: Translating DOOM from C to V, building and running it.\n\nhttps://www.youtube.com/watch?v=6oXrz3oRoEg\n\n\n### Building\n\n```bash\nv .\n```\n... or if you want to debug c2v behaviour:\n```bash\nv -d trace_verbose .\n```\n\nNo dependencies other than a `clang` binary.\n\n\n### Usage\n\nc2v accepts the following arguments:\n```\n-keep_ast           keep ast files\n-print_tree         print the entire tree\n```\n\n```\nc2v file.c\n```\n\nThis will generate `file.v`.\n\n```\nc2v project\n```\n\nThis will translate each C file in the `project` directory.\n\n```\nproject/   ==\u003e  project/\n  a.c              a.c\n  foo.c            a.v\n                   foo.c\n\t\t   foo.v\n```\n\nYou may need to run translated code with `v -translated file.v` until early 2023.\n\n### Wrapper generation\n\nC2V can also generate V wrappers on top of C libraries.\n\n```\nc2v wrapper file.c\n```\n\n###  Notes\n\nC2V is using Clang's AST to generate V. This allowed us to avoid writing a C parser.\n\nIn order to avoid LLVM dependencies/C++ complexity, C2V parses AST generated by the `clang` binary.\n\n\n### Configuration\nC2V supports reading from a project configuration file named `c2v.toml`,\nlocated in one of these places, in this order:\n1) if C2V_CONFIG is set, it should contain the c2v.toml path.\n2) the project folder (the last folder passed to c2v) + /c2v.toml\n3) the project folder (the folder of the file that is last passed to c2v) + /c2v.toml\n\nThat file has the following format:\n```toml\n[project]\nuses_sdl = true\noutput_dirname = \"c2v_out.dir\"\nadditional_flags = \"-I. -I.. -I../..\"\n\n[\"info.c\"]\nadditional_flags = \"-I/some/folder/used/only/for/that/specific/file\"\n```\n\nIn the above:\n    `uses_sdl` is a boolean, that defaults to false.\n    When it is true, c2v will append the result of `sdl2-config --cflags` to `additional_flags` .\n    `output_dirname` is a string, that defaults to `c2v_output`.\n    c2v will create that folder, if it does not exist,\n    and it will put all the translated .v files there.\n    `additional_flags` is a string, that will be passed verbatim to the\n    clang parser for each .c file. It can be used to pass additional -I flags,\n    that are specific to your project, so that clang can find all the headers\n    needed by that project.\n\nNote: all these are global to the project.\n\nThe c2v.toml configuration file also supports file specific overrides,\nfor the `additional_flags` option, just put them in their own sections,\ntitled as the file name.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlang%2Fc2v","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvlang%2Fc2v","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlang%2Fc2v/lists"}