{"id":18928913,"url":"https://github.com/smercer10/vb2c","last_synced_at":"2026-05-01T18:31:56.119Z","repository":{"id":295340590,"uuid":"758926612","full_name":"smercer10/vb2c","owner":"smercer10","description":"(Very) BASIC-to-C compiler.","archived":false,"fork":false,"pushed_at":"2024-05-14T12:14:17.000Z","size":69,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-25T01:41:25.432Z","etag":null,"topics":["basic","c","compiler","cpp"],"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/smercer10.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}},"created_at":"2024-02-17T13:40:35.000Z","updated_at":"2025-04-25T11:47:58.000Z","dependencies_parsed_at":"2025-05-25T01:41:31.205Z","dependency_job_id":"a6865838-0a6d-4906-a260-d4503ee26dc4","html_url":"https://github.com/smercer10/vb2c","commit_stats":null,"previous_names":["smercer10/vb2c"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/smercer10/vb2c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smercer10%2Fvb2c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smercer10%2Fvb2c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smercer10%2Fvb2c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smercer10%2Fvb2c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smercer10","download_url":"https://codeload.github.com/smercer10/vb2c/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smercer10%2Fvb2c/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32508900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["basic","c","compiler","cpp"],"created_at":"2024-11-08T11:28:41.518Z","updated_at":"2026-05-01T18:31:56.110Z","avatar_url":"https://github.com/smercer10.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vb2c\n\nvb2c compiles a unique dialect of BASIC, Very BASIC, to C.\n\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/smercer10/vb2c/blob/main/LICENSE)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/smercer10/vb2c/ci.yml?label=CI)](https://github.com/smercer10/vb2c/actions/workflows/ci.yml)\n\n## Current Language Features\n\n- Numerical variables\n- Floating-point arithmetic\n- Comparison operators\n- If statements\n- While loops\n- Goto and labels\n- User input\n- Console output\n- Comments\n- Conditional includes\n- Basic compile-time error checking\n\n## Usage\n\n```bash\nvb2c -s \u003cpath to source file\u003e [-o \u003cpath to output file\u003e]\n```\n\nIf unspecified, the default output file is `out.c` in the current working directory.\n\nThe `vbas` file extension is recommended for Very BASIC source code, but it is by no means required.\n\n## Example\n\n### **Very BASIC** Source Code\n\n```bas\n# Compute the mean of a specified number of test scores\n\nLET a = 0\nWHILE a \u003c 1 REPEAT\n    PRINT \"Enter number of scores: \"\n    INPUT a\nENDWHILE\n\nLET b = 0\nLET s =  0\nPRINT \"Enter one value at a time: \"\nWHILE b \u003c a REPEAT\n    INPUT c\n    LET s = s + c\n    LET b = b + 1\nENDWHILE\n\nPRINT \"Average: \"\nPRINT s / a\n```\n\n### Generated **C** Code (After Autoformatting)\n\n```c\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\nint main(void)\n{\n    float a;\n    float b;\n    float s;\n    float c;\n    a = 0;\n    while (a \u003c 1)\n    {\n        printf(\"Enter number of scores: \\n\");\n        if (scanf(\"%f\", \u0026a) == EOF)\n        {\n            printf(\"Error: Invalid input\\n\");\n            exit(EXIT_FAILURE);\n        }\n    }\n    b = 0;\n    s = 0;\n    printf(\"Enter one value at a time: \\n\");\n    while (b \u003c a)\n    {\n        if (scanf(\"%f\", \u0026c) == EOF)\n        {\n            printf(\"Error: Invalid input\\n\");\n            exit(EXIT_FAILURE);\n        }\n        s = s + c;\n        b = b + 1;\n    }\n    printf(\"Average: \\n\");\n    printf(\"%.2f\\n\", s / a);\n    return EXIT_SUCCESS;\n}\n```\n\n## Grammar Specification\n\nThe current Very BASIC grammar is defined by the following EBNF:\n\n```ebnf\nprogram ::= {statement}\nstatement ::= \"PRINT\" (expression | string) newline\n    | \"IF\" comparison \"THEN\" newline {statement} \"ENDIF\" newline\n    | \"WHILE\" comparison \"REPEAT\" newline {statement} \"ENDWHILE\" newline\n    | \"LABEL\" ident newline\n    | \"GOTO\" ident newline\n    | \"LET\" ident \"=\" expression newline\n    | \"INPUT\" ident newline\ncomparison ::= expression ((\"==\" | \"!=\" | \"\u003e\" | \"\u003e=\" | \"\u003c\" | \"\u003c=\") expression)+\nexpression ::= term {( \"-\" | \"+\" ) term}\nterm ::= unary {( \"/\" | \"*\" ) unary}\nunary ::= [\"+\" | \"-\"] primary\nprimary ::= number | ident\nnewline ::= \"\\n\"+\n```\n\n## Build Locally\n\n### Prerequisites\n\n- C++20 compiler (tested with GCC and Clang)\n- CMake 3.14+\n- Clang-Format (optional)\n- Clang-Tidy (optional)\n\n### Steps\n\n1. Clone the project:\n\n```bash\n  git clone https://github.com/smercer10/vb2c.git\n```\n\n2. Navigate to the project directory:\n\n```bash\n  cd vb2c\n```\n\n3. Generate the build files:\n\n```bash\n  cmake -S . -B build\n```\n\n4. Build the project:\n\n```bash\n  cmake --build build\n```\n\n## Running Tests\n\nThe project utilises the GoogleTest framework with CTest.\n\nTo execute the testcases, run the following command from the project root:\n\n```bash\n  cmake --build build --target test\n```\n\n## Contributing\n\nContributions are always welcome!\n\nSee [open issues](https://github.com/smercer10/vb2c/issues) for ways to get started.\n\n## Acknowledgements\n\nThe compiler design is based on the excellent [blog series](https://austinhenley.com/blog/teenytinycompiler1.html) by Austin Henley.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmercer10%2Fvb2c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmercer10%2Fvb2c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmercer10%2Fvb2c/lists"}