{"id":18745439,"url":"https://github.com/gioblu/biplan","last_synced_at":"2025-09-07T00:31:41.527Z","repository":{"id":53819912,"uuid":"98957338","full_name":"gioblu/BIPLAN","owner":"gioblu","description":"Byte coded Interpreted Programming language","archived":false,"fork":false,"pushed_at":"2025-07-21T23:11:54.000Z","size":588,"stargazers_count":68,"open_issues_count":4,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-22T06:11:51.873Z","etag":null,"topics":["arduino","compiler","edge-computing","embedded","esolang","esoteric-language","interpreter","linux","programming-language","virtual-machine"],"latest_commit_sha":null,"homepage":"","language":"C","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/gioblu.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":"2017-08-01T03:55:49.000Z","updated_at":"2025-07-21T23:11:58.000Z","dependencies_parsed_at":"2025-05-31T15:36:40.487Z","dependency_job_id":"5cc5796e-48bb-44c2-95b0-6e3063f99034","html_url":"https://github.com/gioblu/BIPLAN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gioblu/BIPLAN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gioblu%2FBIPLAN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gioblu%2FBIPLAN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gioblu%2FBIPLAN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gioblu%2FBIPLAN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gioblu","download_url":"https://codeload.github.com/gioblu/BIPLAN/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gioblu%2FBIPLAN/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273982930,"owners_count":25202092,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"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":["arduino","compiler","edge-computing","embedded","esolang","esoteric-language","interpreter","linux","programming-language","virtual-machine"],"created_at":"2024-11-07T16:18:06.020Z","updated_at":"2025-09-07T00:31:41.513Z","avatar_url":"https://github.com/gioblu.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## BIPLAN CR.1\nBIPLAN CR.1 (Bytecoded Interpreted Programming Language) is an experimental programming language that fits in less than 48KB of program memory and it is implemented in less than 2000 lines of code. BIPLAN is a very compact language, even more compact than Wasm3, MicroPython or Lua. It is so compact that the BIPLAN interpreter fits in an Arduino Mega.\n\n| Programming language | Minimum requirements |\n| -------------------- | -------------------- |\n| TinyBasicPlus        |  11KB ROM,  1KB RAM  |\n| BIPLAN               |  48KB ROM,  5KB RAM  |\n| Wasm3                |  64kB ROM, 10kB RAM  |\n| MycroPython          | 256KB ROM, 16KB RAM  |\n| Lua                  | 256KB ROM, 64kB RAM  |\n\nThe BIPLAN virtual machine implements the \"fictional\" BIP CR.1 computer architecture that operates with the BIP ASCII bytecode. It includes a serial interface, input-output ports, analog-to-digital and digital-to-analog converters, mono sound, text mode graphics and file handling.\n\n### Why?\nIn 2017 I built a couple of standalone programmable computers with a screen and a keyboard using Arduino boards and running software I could more or less understand. In this [video](https://www.youtube.com/watch?v=xRZ9abs5ywA) you can see one machine I made in operation. At the end I was forced to use [TinyBasicPlus](https://github.com/BleuLlama/TinyBasicPlus/blob/master/TinyBasicPlus/TinyBasicPlus.ino) because it was the only implementation that fitted in them. The result was a machine with features comparable to an IBM 5150 booted into BASIC. Looking at it I asked myself: \"How can BASIC, the first attempt to popularize programming, source of billions of lines of spaghetti code, now 57 years old, still be the only viable option?\". I just needed a simple interpreted programming language implemented in C, with very few dependencies and layers of abstraction. After some experiments I decided to design and implement a new viable option for this use case, a programming language that is simple, portable, modern, but at the same time small enough to run even on limited micro-controllers.\n\n### How?\n\nThe development of BIPLAN started in 2017, I wrote both the compiler and the interpreter from scratch avoiding external libraries, frameworks and the influence of compiler and interpreter design studies, learning by doing and evaluating results. In 5 years of experiments I wrote `BCC`, a pre-processor and multi-pass compiler capable of syntax and lexical analysis (576 lines of code), and `BIPLAN`, a register-based virtual machine implemented with a recursive descent parser (784 lines of code).\n\n### Code example\n\nFibonacci sequence computation in 149 bytes of BIPLAN code:\n```c\nprint fibonacci(40)\nstop\nfunction fibonacci($a, locals: $b, $c)\n  $b = 1\n  for #r = 0 to $a\n    $a = $b\n    $b = $c\n    $c = $a + $b\n  next\nreturn $c\n```\nCompiled in 44 bytes of BIP bytecode by the [`BCC`](/src/BCC.h) class:\n```\np~$40)xf$}j}k}l)}k1@$0,}j}j}k}k}l}l}j+}k;r}l\n```\nCompiler output:\n```\nBCC (BIP Compiler Collection) Giovanni Blu Mitolo 2025 \nSource: fib.biplan \nTarget: fib.bip \nSource length: 149B, BIP length: 44B, reduction: 70.469803% \nCompilation time: 294 microseconds \n```\nInterpreted at run time by the [`BIPLAN_Interpreter`](/src/BIPLAN.c) class:\n```\n102334155\n```\nOn my linux computer the [biplan-interpreter](examples/LINUX/biplan-interpreter/) needs around 30 microseconds to run the algorithm.\n\n### Performance\n\nWhen `biplan` is compiled using the target `fast` it is around 1.3 times slower than python, when compiled using the target `compact` it is around 2 times slower than python.\n\n### Documentation\n- [Bytecode](/documentation/bytecode.md)\n- [Configuration](/documentation/configuration.md)\n- [Comments](/documentation/comments.md) [`//`](/documentation/comments.md)\n- [Conditions](/documentation/conditions.md) [`if`](/documentation/conditions.md) [`else`](/documentation/conditions.md) [`end`](/documentation/conditions.md)\n- [Constants](/documentation/constants.md) [`true`](/documentation/constants.md) [`false`](/documentation/constants.md) [`HIGH`](/documentation/constants.md) [`LOW`](/documentation/constants.md) [`INPUT`](/documentation/constants.md) [`OUTPUT`](/documentation/constants.md)\n- [Cycles](/documentation/cycles.md) [`for`](/documentation/cycles.md#for) [`while`](/documentation/cycles.md#while) [`next`](/documentation/cycles.md#next) [`break`](/documentation/cycles.md#break) [`continue`](/documentation/cycles.md#continue)\n- [Functions](/documentation/functions.md) [`function`](/documentation/functions.md) [`locals`](/documentation/functions.md) [`return`](/documentation/functions.md)\n- [Macros](/documentation/macros.md) [`macro`](/documentation/macros.md#pre-processor-macros)\n- [Numeric variables](/documentation/numeric-variables.md) [`$`](/documentation/numeric-variables.md) [`$[]`](/documentation/numeric-variables.md)\n- [Operators](/documentation/operators.md) [`+`](/documentation/operators.md) [`-`](/documentation/operators.md) [`*`](/documentation/operators.md) [`/`](/documentation/operators.md) [`%`](/documentation/operators.md) [`==`](/documentation/operators.md) [`!=`](/documentation/operators.md) [`\u003e`](/documentation/operators.md) [`\u003e=`](/documentation/operators.md) [`\u003c`](/documentation/operators.md) [`\u003c=`](/documentation/operators.md) [`\u0026\u0026`](/documentation/operators.md) [`||`](/documentation/operators.md) [`\u0026`](/documentation/operators.md) [`|`](/documentation/operators.md) [`^`](/documentation/operators.md) [`\u003e\u003e`](/documentation/operators.md) [`\u003c\u003c`](/documentation/operators.md) [`++`](/documentation/operators.md) [`--`](/documentation/operators.md) [`~`](/documentation/operators.md) [`not`](/documentation/operators.md)\n- [Strings](/documentation/strings.md) [`:`](/documentation/strings.md) [`:[]`](/documentation/strings.md)\n- [System functions](/documentation/system-functions.md) [`adc read`](/documentation/system-functions.md#adc-read) [`args`](/documentation/system-functions.md#args) [`char`](/documentation/system-functions.md#print) [`cursor`](/documentation/system-functions.md#cursor) [`delay`](/documentation/system-functions.md#delay) [`file close`](/documentation/system-functions.md#file-close) [`file open`](/documentation/system-functions.md#file-open) [`file read`](/documentation/system-functions.md#file-read) [`file write`](/documentation/system-functions.md#file-write) [`include`](/documentation/system-functions.md#include) [`index`](/documentation/system-functions.md#index) [`input`](/documentation/system-functions.md#input) [`io open`](/documentation/system-functions.md#io-open) [`io read`](/documentation/system-functions.md#io-read) [`io write`](/documentation/system-functions.md#digitalWrite) [`mem`](/documentation/system-functions.md#mem) [`millis`](/documentation/system-functions.md#millis) [`number`](/documentation/system-functions.md#number) [`numeric`](/documentation/system-functions.md#numeric) [`print`](/documentation/system-functions.md#print) [`random`](/documentation/system-functions.md#random) [`restart`](/documentation/system-functions.md#restart) [`serial open`](/documentation/system-functions.md#serial-open) [`serial read`](/documentation/system-functions.md#serial-read) [`serial write`](/documentation/system-functions.md#serial-write) [`size`](/documentation/system-functions.md#size) [`stop`](/documentation/system-functions.md#stop) [`string`](/documentation/system-functions.md#string) [`system`](/documentation/system-functions.md#system)\n- [Unary operators](/documentation/unary-operators.md) [`++`](/documentation/unary-operators.md) [`--`](/documentation/unary-operators.md)\n\n### Building BIPLAN\n\nAll you need to build BIPLAN is `g++`.\n\n- [Build the compiler on Linux](/examples/LINUX/bcc-compiler/)\n- [Build the compiler on OSX](/examples/OSX/bcc-compiler/)\n- [Build the interpreter on Linux](/examples/LINUX/biplan-interpreter/)\n- [Build the interpreter on OSX](/examples/OSX/biplan-interpreter/)\n- [Linux examples](/examples/LINUX/)\n- [OSX examples](/examples/OSX/)\n- [Arduino examples](/examples/ARDUINO/)\n\n### License\nThe license grants permission to use, copy, modify, merge, publish and distribute BIPLAN, only to individuals, for experimental purposes. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND. You are solely responsible for using, copying, modifying, merging, publishing or redistributing BIPLAN and assume any risks associated with your exercise of permissions under this License:\n\n```\nDefinitions.\n\n\"You\" (or \"Your\") shall mean an individual, human, exercising\npermissions granted by this License.\n\n\"Software\" shall mean the source code, associated documentation\nand configuration files included in the BIPLAN directory.\n\n\"License\" shall mean the conditions for use, copy, modify, merge, publish or\ndistribute the Software as defined by Section 1 through 3 of this document.\n\nBIPLAN Experimenter's License\n\nCopyright 2022 Giovanni Blu Mitolo\n\nPermission is hereby granted to You, free of charge, the rights to use, copy,\nmodify, merge, publish or distribute copies of the Software, subject to the\nfollowing conditions:\n\n1.Use, copy, modify, merge, publish or distribute the Software only for\n  experimental or educational purposes.\n\n2.Companies, institutions, organizations and corporations don't have the right\n  to use, copy, modify, merge, publish or distribute the Software.\n\n3.THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n  YOU ARE SOLELY RESPONSIBLE FOR USING, COPYING, MODIFYING, MERGING, PUBLISHING\n  OR REDISTRIBUTING THE SOFTWARE AND ASSUME ANY RISKS ASSOCIATED WITH YOUR\n  EXERCISE OF PERMISSIONS UNDER THIS LICENSE.\n```\n\nThe version name CR.1 was chosen to honour the italian [FIAT CR.1](https://en.wikipedia.org/wiki/Fiat_CR.1) biplane fighter aircraft. It was designed by Celestino Rosatelli, from whom it gained the 'CR' designation. The CR.1 was a [Sesquiplane](https://en.wikipedia.org/wiki/Biplane#Sesquiplane) of Wood-and-fabric construction.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgioblu%2Fbiplan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgioblu%2Fbiplan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgioblu%2Fbiplan/lists"}