{"id":28120719,"url":"https://github.com/edwindj/rvee","last_synced_at":"2025-05-14T07:42:58.528Z","repository":{"id":37490261,"uuid":"372418525","full_name":"edwindj/rvee","owner":"edwindj","description":"Recreational V programming for R","archived":false,"fork":false,"pushed_at":"2022-06-22T13:28:54.000Z","size":1891,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T15:27:23.853Z","etag":null,"topics":["r","r-package","vlang"],"latest_commit_sha":null,"homepage":"https://edwindj.github.io/rvee","language":"Verilog","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/edwindj.png","metadata":{"files":{"readme":"README.Rmd","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}},"created_at":"2021-05-31T07:23:18.000Z","updated_at":"2025-03-22T10:44:31.000Z","dependencies_parsed_at":"2022-09-15T06:50:47.184Z","dependency_job_id":null,"html_url":"https://github.com/edwindj/rvee","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/edwindj%2Frvee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwindj%2Frvee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwindj%2Frvee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwindj%2Frvee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edwindj","download_url":"https://codeload.github.com/edwindj/rvee/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254096679,"owners_count":22014074,"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":["r","r-package","vlang"],"created_at":"2025-05-14T07:41:38.705Z","updated_at":"2025-05-14T07:42:58.516Z","avatar_url":"https://github.com/edwindj.png","language":"Verilog","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# `rvee`\n\n## Recreational V programming for R / WIP\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/rvee)](https://CRAN.R-project.org/package=rvee)\n[![R-CMD-check](https://github.com/edwindj/rvee/workflows/R-CMD-check/badge.svg)](https://github.com/edwindj/rvee/actions)\n\u003c!-- badges: end --\u003e\n\n**Early work! (not ready for production)**\n \nCreate R extension packages with the [V programming language](https://vlang.io).\nV is a simple, safe and fast programming language with the speed of C.\n\nR has good interfaces for many programming languages such as [C](https://cran.r-project.org/doc/manuals/r-release/R-exts.html#System-and-foreign-language-interfaces)\n, [fortran](https://cran.r-project.org/doc/manuals/r-release/R-exts.html#System-and-foreign-language-interfaces)\n, cpp (e.g. [Rcpp](http://www.rcpp.org/))\n, python (e.g. [reticulate](https://rstudio.github.io/reticulate/))\nand rust (e.g. [r-rust](https://github.com/r-rust)).\nR Package `rvee` intends to provide an easy toolkist for creating R packages with \nthe `v` programming language.\n\n## Status\n\nTranslation to `C` and compilation 🎉!\n\nInterfacing:\n\n- [x] Generating all interfacing code from `v` file with `rvee::rv_export_c()`\n- [x] wraps simple input and return types: `f64`, `int`, `bool`,  `string`\n- [x] wraps `numeric`, `logical`, `integer`, `character`, `factor` and `list` input and return types.\n- [x] compiling and working :-)\n- [ ] wraps `data.frame` input and return types.\n- [ ] wraps array input and return types: `[]f64`, `[]int`, `[]bool`,  `[]string`\n- [x] CRAN checks\n\nr module (in v):\n\n- [x] `Numeric`, direct access as a `[]f64`\n- [x] `Integer`, direct access as a `[]int`\n- [x] `Character`, indirect access as a `[]string`. string values of R are reused, but newly created string (not managed by R) are copied.\n- [x] `Logical`, indirect access as a `[]bool`. automatically converts between `[]bool` and `logical`.\n- [x] `Factor` \n- [x] `List`\n- [x] `DataFrame`\n- [ ] `Environment`\n- [ ] `Function`\n\n## Installation\n\n\nThe **unstable** development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"edwindj/rvee\")\n```\n\n## Overview\n\nPossible routes for creating an R extension with `v` code are:\n\na) Transpiling `V` code to `C` code and use it as a normal `C` extension.\nb) Using the `v` compiler to build a shared library linked to the R shared library.\n\nBoth options have their benefits and draw backs:\n\na) Allows for easy distribution and installation, but requires tweaking the compilation\nflags to pass CRAN checks etc. and removing/stripping code that is not needed by R.\n\nb) Allows for an optimized shared library, but requires `v` to be installed by the\ninstaller (e.g. CRAN).\n\n## Example\n\nTranspiling to C works.\n\nPut your `v` files in the `\"\u003cpkg\u003e/src/v\"` directory and decorate each function to be\nexported with the `[rv_export]` attribute (see example below).\n\nAfter that \n\n`rvee::rv_export_c` generates the necessary interfacing code:\n\n- `\"./R/rv_export.R\"`: R functions calling the v functions declared in `\"./src/v/rv_export.v\"`\n- `\"./src/v/rv_export.v\"`: v wrapper functions translating input and output to the original v functions.\n- `\"./src/init.c\"`: registration code for the shared library\n- `\"./src/\u003cpkg\u003e.c\"`: the c code generated by `v` from the source files in the\n`\"\u003cpkg\u003e/src/v\"` directory.\n\nAfter that  `devtools::load_all` (or `R CMD SHLIB`) work: they will compile `\"init.c\"`\nand `\"\u003cpkg\u003e.c\"` into `\"\u003cpkg\u003e.so\"`/`\"\u003cpkg\u003e.dll\"`.\n\nSuppose we have the following file \"\u003cpkg\u003e/src/example.v\"\n\n```{r, eval = FALSE, results=\"asis\", code=readLines(\"example/example.v\")}\n```\n\nWith:\n\n```{r, eval=FALSE}\nrvee::rv_export_c(\"\u003cpkg\u003e\", prefix=\"my_pkg\") # \u003cpkg\u003e is root dir of the source of your package...\n```\n \nThe interfacing code is generated:\n\n`\"\u003cpkg\u003e/src/v/rv_export.v\"`:\n\n```v\n```{r, echo=FALSE, results='asis'}\nfns \u003c- rvee:::scan_v_file(\"example/example.v\")\npkg \u003c- \"my_pkg\"\nrvee:::generate_rv_export_v(fns,pkg=pkg)\n```\n```\n\nand \n\n`\"\u003cpkg\u003e/R/rv_export.R\"`:\n\n```r\n```{r, echo=FALSE, results='asis'}\nrvee:::generate_rv_export_R(fns, pkg = pkg)\n```\n```\n \nAnd create the shared library with a call to devtools\n\n```{r, eval = FALSE}\ndevtools::load_all(\"\u003cpkg\u003e\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwindj%2Frvee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedwindj%2Frvee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwindj%2Frvee/lists"}