{"id":19074950,"url":"https://github.com/varbhat/bast","last_synced_at":"2025-04-29T16:26:57.081Z","repository":{"id":57536688,"uuid":"283265141","full_name":"varbhat/bast","owner":"varbhat","description":"Compiler for Tiny Toy BASIC Dialect","archived":false,"fork":false,"pushed_at":"2022-01-18T14:18:11.000Z","size":34,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-18T19:41:34.445Z","etag":null,"topics":["basic","compiler","golang","golang-application"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"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/varbhat.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}},"created_at":"2020-07-28T16:15:45.000Z","updated_at":"2024-09-13T06:05:45.000Z","dependencies_parsed_at":"2022-08-28T23:31:59.925Z","dependency_job_id":null,"html_url":"https://github.com/varbhat/bast","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varbhat%2Fbast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varbhat%2Fbast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varbhat%2Fbast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varbhat%2Fbast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varbhat","download_url":"https://codeload.github.com/varbhat/bast/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251538762,"owners_count":21605579,"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":["basic","compiler","golang","golang-application"],"created_at":"2024-11-09T01:52:52.788Z","updated_at":"2025-04-29T16:26:57.062Z","avatar_url":"https://github.com/varbhat.png","language":"Go","readme":"\u003ch1 align=\"center\"\u003ebast\u003c/h1\u003e \n\u003cp align=\"center\"\u003eCompiler for BAST(Basic Tiny) - A Tiny Toy Basic Dialect\u003c/p\u003e\n\n\n## Introduction\nThis compiler takes code written in bast and compiles(transpiles) to C code.You need to compile the C code with C compiler (gcc/tcc/clang are tested to work) to produce executable.\n\nThis provided the opportunity to learn about lexing,parsing and to learn more Golang. I believe that this toy language will not be used other than for educational purpose(for people like past-me).\n\n## Installation \nYou can download binary for your OS from [Releases](https://github.com/varbhat/bast/releases/latest) . Also , if you have [Go](https://golang.org/) installed , you can install `bast` by typing this in terminal.\n\n```bash\ngo install github.com/varbhat/bast@latest\n```\n\n## Usage\n\n* `bast --help` will print the help.\n\n* `bast -in=filename.bast -out=filename.c` will compile bast source `filename.bast` to C source `filename.c`. \n\n* You need to compile the emitted C file with C compiler like GCC/Clang/TCC.\n\n* `cc ./filename.c -o filename` (where cc is gcc/clang/tcc)\n\n* You can combine these steps :\n\n```bash\nbast -in=filename.bast -out=filename.c \u0026\u0026 cc filename.c -o filename\n```\n\nAnd then run the executable binary `filename` it produced.\n\n## Language \nLanguage is small Dialect of BASIC same what AZHenly implemented.I only wrote compiler.\nGrammer file can be found at [grammer.txt](https://github.com/varbhat/bast/blob/master/grammar.txt)\n\nIt supports:\n  - Numerical variables\n  - Basic arithmetic\n  - If statements\n  - While loops\n  - Print text and numbers\n  - Input numbers\n  - Labels and goto\n  - Comments\n\n## Example code\n\n```\nPRINT \"How many fibonacci numbers do you want?\"\nINPUT nums\nPRINT \"\"\n\nLET a = 0\nLET b = 1\nWHILE nums \u003e 0 REPEAT\n    PRINT a\n    LET c = a + b\n    LET a = b\n    LET b = c\n    LET nums = nums - 1\nENDWHILE\n```\nYou can find more examples at [Examples](https://github.com/varbhat/bast/tree/master/examples)\n\n## Acknowledgements\nThanks to [AZHenly](https://github.com/AZHenley) for their post  [Let's make a Teeny Tiny compiler](http://web.eecs.utk.edu/~azh/blog/teenytinycompiler1.html) which acted as reference. \nBut , instructions in that post are for Python and the compiler is implemented in Python. I who wanted to know more about compiler , read it as reference , wrote the compiler from scratch in Golang.\n\nAlthough the language for both the compilers are same,`bast` compiler is written from scratch in Golang ,implemented by instructions of their post.\n\n## License\n[MIT](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarbhat%2Fbast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarbhat%2Fbast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarbhat%2Fbast/lists"}