{"id":18497570,"url":"https://github.com/csb6/bluebird","last_synced_at":"2025-04-09T00:30:37.075Z","repository":{"id":115656129,"uuid":"270506294","full_name":"csb6/bluebird","owner":"csb6","description":"A work-in-progess programming language modeled after Ada and C++","archived":false,"fork":false,"pushed_at":"2022-12-11T03:52:10.000Z","size":1804,"stargazers_count":25,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-23T19:44:31.802Z","etag":null,"topics":["ada","cpp","cpp17","imperative-programming","programming-language"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csb6.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}},"created_at":"2020-06-08T02:55:50.000Z","updated_at":"2024-11-22T17:27:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a7f07d8-3a55-41f3-861a-8f69865eba9e","html_url":"https://github.com/csb6/bluebird","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/csb6%2Fbluebird","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csb6%2Fbluebird/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csb6%2Fbluebird/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csb6%2Fbluebird/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csb6","download_url":"https://codeload.github.com/csb6/bluebird/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247949659,"owners_count":21023364,"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":["ada","cpp","cpp17","imperative-programming","programming-language"],"created_at":"2024-11-06T13:34:59.318Z","updated_at":"2025-04-09T00:30:37.069Z","avatar_url":"https://github.com/csb6.png","language":"C++","readme":"# Bluebird\n\nBluebird is an imperative programming language modeled after C++ and Ada.\n\nThe goal is to create a language that supports generic programming with\nvery strong typing.\n\nIt is still in the early stages, but right now it has a lexer, a parser,\na semantic analyzer, a code generator, and an optimizer. All stages of the compiler are still\na work-in-progress. At the moment, the compiler has only been built on macOS, but\nit should work on any platform that LLVM supports.\n\n## Currently Implemented Features\n\n- Functions, variables, constants, and assignment\n- Integer, boolean, character, reference, and array types\n- Initializer lists and assignment for arrays\n- Module-global variables\n- If, else-if, and else statements\n- While loops\n- Recursion (with tail-call elimination in optimized builds)\n- Type definitions for integer types, with ranges specified (no runtime range checks yet)\n- Boolean type and an 8-bit character type\n- Logical, comparison, bitwise, and arithmetic operators, as well as parentheses for grouping\n- Detailed error checking, including typechecking and checks to ensure functions that\n  return will return no matter the code path taken\n- Out-of-order declarations of type and function names, preventing the need for forward declarations\n- Debugging support (uses the DWARF format, which should work with at least gdb and lldb)\n- Several code optimization passes\n\n## Goals\n\n- Ahead-of-time compiled language with native LLVM backend\n- Ada-like syntax, but with less verbosity and no need for forward declarations\nwhen defining interdependent types or functions\n- Monomorphized generics with C++20-like concepts for constraining types\n- First-class types\n- Modules with mandatory specifications (a.k.a. header files), but no textual inclusion\n- Very strong typing in the tradition of Ada, with no implicit conversions, but\nwith support for casting when needed\n- Ranges as a core language construct, with support for user-defined ranges\n- Types that can be constrained to a range\n- Support for low-level operations and precise control over data representation\n- Support for a large number of compile-time and run-time checks\n- Support for compile-time evaluation and partial evaluation of functions\n- Standard library containing useful and efficient generic data structures and algorithms\n- Modular compiler implemented with minimal dependencies and a reasonable build time\n- Minimally complex build environment for the compiler and a simple, standard build\nsystem for the language itself\n- Easy way to create C and C++ bindings\n- Compiler tools for interacting with each stage of the compiler, potentially with a GUI\n\n## Syntax\n\nThe syntax is very Ada-like, favoring English keywords over symbols and full words over abbreviations (where sensible). Here is a sample program:\n\n```\ntype Positive is range 1 thru 500;\n\nfunction fizzbuzz() is\n    let n: Positive := 1;\n    while n \u003c= 500 do\n        if n mod 15 = 0 do\n            print(\"fizzbuzz\");\n        else if n mod 3 = 0 do\n            print(\"fizz\");\n        else if n mod 5 = 0 do\n            print(\"buzz\")\n        else\n            print_num(n);\n        end if;\n        n := n + 1;\n    end while;\nend fizzbuzz; // end labels are optional\n```\n\n## Semantics\n\nParameters are passed by value. I plan on eventually implementing pointer types,\nbut for now there are only integer types and a single character type.\n\nVariables are mutable by default; they can be made constant (i.e. allowing no\nreassignment or modification) by adding the `constant` keyword to the declaration:\n\n```\nlet age: constant Age := 99;\n```\n\nThree default types, `Integer` (a 32-bit integer), `Character` (an 8-bit character), and\n`Boolean` do not have to be defined.\n\nAn arbitrary number of additional integer types can be defined, each of which is incompatible\nwith all others. To define an integer type, specify the desired range. The compiler\nwill try to choose a reasonable bit size for values of the new type:\n\n```\ntype Dalmation_Count is range 1 thru 101;\n// Or, equivalently:\ntype Dalmation_Count is range 1 upto 102;\n\nlet original_amt: Dalmation_Count := 96;\nlet puppy_amt: Dalmation_Count := 5;\nlet new_amt: Dalmation_Count := original_amt + puppy_amt; // Allowed\nlet pupp_amt2: Integer := 5;\n// Compilation error (below): cannot use Dalmation_Count and Integer together\nlet new_amt2: Dalmation_Count := original_amt + puppy_amt2;\n```\n\n## Building\n\n### Platforms\n\nThe compiler has only been built/tested on macOS Monterey, and it likely will\nnot work on older macOS versions without some tweaking of the CMakeLists.\n\nOtherwise it should work on any platform supported by CMake and LLVM.\n\n### Dependencies\n\n- C++17 compiler\n- CMake (\u003e= 3.16.4)\n- LLVM 12\n- All other dependencies will be bundled into the `third_party/` directory\n\n### Compiling the compiler\n\nThe build system is CMake.\n\nTo build, enter the `build/` directory of this project, then run:\n\n```\ncmake ..\ncmake --build .\n```\n\nAll build files/artifacts will be placed inside `build/`.\n\nTo rebuild from scratch run (from inside `build/`):\n\n```\ncmake --build . --clean-first\n```\n\nTo build using multiple cores (which should be faster), you can also add\nthe `--parallel` flag like so:\n\n```\ncmake --build . --parallel\n```\n\nIf you have any issues building, please leave a Github issue.\n\n### Running the compiler\n\nThe compiler executable, `bluebird`, should be found in the `build` directory\nafter the build finishes. Pass it a filename to compile something\n(e.g. `bluebird ../examples/arithmetic.bird`). An object file with the same name (but\na `.o` extension instead of a `.bird` extension) as well as an `a.out` executable\nshould be produced.\n\nIf you encounter a compiler bug, crash, or miscompilation, please leave a Github issue.\n\n#### Compiler options\n\nCompiler options are always placed first, before the source file name.\n(e.g. `bluebird --debug ../examples/arithmetic.bird`)\n\nNote that debug and optimization modes are mutually exclusive;\nthe last given flag will override any prior debug/optimization flags.\n\n- `(no options given)`: Build with no optimizations or debug symbols\n- `-g` or `--debug`: Build with debug symbols, no optimizations\n- `-O` or `--optimize`: Build with optimizations, no debug symbols\n- `--linker-exe-path /path/to/linker`: Link the generated object files using a linker\n different from the default system linker\n\n## License\n\nThis program is licensed under the AGPLv3 license. The text of the AGPL can be found in\nthe LICENSE file.\n\nDependencies in the `third_party/` directory may have separate licenses; refer to their\ndocumentation/source code for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsb6%2Fbluebird","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsb6%2Fbluebird","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsb6%2Fbluebird/lists"}