{"id":13609243,"url":"https://github.com/ExoKomodo/Daybreak","last_synced_at":"2025-04-12T20:31:39.603Z","repository":{"id":36981299,"uuid":"443449029","full_name":"ExoKomodo/daybreak","owner":"ExoKomodo","description":"Programming language that compiles to C","archived":false,"fork":false,"pushed_at":"2024-07-04T14:30:47.000Z","size":3303,"stargazers_count":10,"open_issues_count":33,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-07T15:55:02.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ExoKomodo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-01T00:57:45.000Z","updated_at":"2024-07-04T14:30:51.000Z","dependencies_parsed_at":"2024-08-01T19:43:06.873Z","dependency_job_id":"acc3be4f-e1c7-4e28-b861-b04053a3d05c","html_url":"https://github.com/ExoKomodo/daybreak","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/ExoKomodo%2Fdaybreak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExoKomodo%2Fdaybreak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExoKomodo%2Fdaybreak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExoKomodo%2Fdaybreak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ExoKomodo","download_url":"https://codeload.github.com/ExoKomodo/daybreak/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248629583,"owners_count":21136278,"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":[],"created_at":"2024-08-01T19:01:33.554Z","updated_at":"2025-04-12T20:31:38.835Z","avatar_url":"https://github.com/ExoKomodo.png","language":"C","readme":"# Daybreak\n\nProgramming language that compiles to C\n\n## Motivation\n\nWhile my wife was pregnant with our first child, I made this for my daughter to be\n\nI wanted to have something to do that would focus me giving my time and energy to my child before I could actually hold and care for them\n\nMy baby arrived in 2022 and she is more beautiful and complex than anything I could have made, other than she herself\n\n## Table of Contents\n\n- [Important Links](#important-links)\n- [Development](#development)\n- [Daybreak Install](#daybreak-install)\n\n## Important Links\n\n- [Language Cheat Sheet](https://docs.google.com/document/d/1VsP0L_J_NGatTqUZniUga4odmSZfCDRTvfQCVJQn9ac/edit?usp=sharing)\n- [Github Repository](https://github.com/ExoKomodo/daybreak)\n- [Jenkins](https://jenkins.exokomodo.com/job/daybreak)\n- [Jenkins - Base Image](https://jenkins.exokomodo.com/job/daybreak-base)\n- [Jenkins - Devcontainer Image](https://jenkins.exokomodo.com/job/daybreak-devcontainer)\n- [Docker Hub - Daybreak](https://hub.docker.com/repository/docker/exokomodo/daybreak)\n- [Docker Hub - Development](https://hub.docker.com/repository/docker/exokomodo/development)\n\n## Installation\n\nTo install daybreak locally, clone the Daybreak repo to your machine, and run `daybreak_install.bash`\n\n### (Recommended) Git Clone via SSH:\n\nCloning via SSH will allow for you to contribute to Daybreak and push commits\n```bash\n# Clone repository locally\ngit clone git@github.com:ExoKomodo/daybreak.git\n# Temporarily move into Daybreak repo\ncd ./Daybreak\n# Follow the instructions of the install script\nbash ./daybreak_install.bash\n```\n\n### (Not recommended) Git clone via HTTPS:\n\nCloning via HTTPS will only allow for you to clone the repo and install Daybreak. You will not be able to push commits to Github with an HTTPS-cloned repository.\n```bash\n# Clone repository locally\ngit clone https://github.com/ExoKomodo/daybreak.git\n# Temporarily move into daybreak repo\ncd ./daybreak\n# Follow the instructions of the install script\nbash ./daybreak_install.bash\n```\n\n### Bootstrapping a new platform\n\nTo bootstrap a new compiler, a generated C source of Daybreak is needed to bootstrap the core Daybreak code into a binary. Clone the git repo either via HTTPS or SSH.\n```bash\n# Clone the repository locally\ngit clone git@github.com:ExoKomodo/daybreak.git\n# Temporarily move into daybreak repo\ncd ./daybreak\n# Set C_INCLUDE_PATH to use the includes of the cloned repo\nexport C_INCLUDE_PATH=./src/include:${C_INCLUDE_PATH}\n```\nOnce the environment is setup, get the C source for the desired commit from the CI.\nSadly, Github's API is complex for this process and means that doing this without a web browser requires an API token.\nThe easiest method is to download the daybreak-linux.zip artifact from an action and work with that as so\n```bash\nunzip daybreak-linux.zip\ncd daybreak-linux\ncc main.day.c -o daybreak\n```\nDaybreak should now be fully bootstrapped and functioning on the new platform\n\n## Suggested VSCode Extensions\n\nReference [`devcontainer.json`](./.devcontainer/devcontainer.json)'s `extensions` array to see what VSCode extensions are recommended.\n\n## CI/CD\n\n[![Jenkins Build Status](https://jenkins.exokomodo.com/buildStatus/icon?job=daybreak/main)](http://jenkins.exokomodo.com/job/daybreak/job/main/)\n![Bootstrap Workflow](https://github.com/ExoKomodo/daybreak/actions/workflows/bootstrap.yml/badge.svg)\n\n\n## Development\n\n### [Recommended] VSCode Dev Container\n\nUsing VSCode Dev Containers is the recommended way to develop Daybreak. To do so, either use [Github Codespaces](https://github.com/features/codespaces) or:\n1. Install\n[Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)\n1. Follow the instructions [here](https://code.visualstudio.com/docs/remote/containers)\n1. Follow the Ubuntu instructions below for running commands in the container\n\nThe Dev Container setup is finished and you can start developing on Daybreak right away using Docker Compose.\n\nUse the following [Docker Compose](#docker-compose) instructions to develop Daybreak\n\n### Docker Compose\n\nDocker Compose provides a declarative way to define how docker containers should be run.\n\nIn Daybreak, this functionality is used to run different kinds of tasks within a container that is configured for Daybreak development.\n\nThe CI/CD pipeline for Daybreak simply calls compose services defined in [`docker-compose.yaml`](./docker-compose.yaml), so it is sufficient to use these same services for local development.\n\n#### Environment\n\nIn the services, these environment variables are defined by default:\n- `C_INCLUDE_PATH=/app/src/include:/app/tests/include` Defines the include paths for the underlying C compiler\n- `CC_COMPILER=gcc` Defines which c compiler to use for compose services\n\nThese environment variables are defined by default for the VSCode Dev Container, but will need to be defined for local compose usage\n- `DAYBREAK_BOOTSTRAP=/workspaces/daybreak/bootstrap/linux/daybreak` Bootstrap executable location\n- `OUT=/workspaces/Daybreak/out` Output directory for artifacts\n\n#### Services\n\nServices are defined in the [`docker-compose.yaml`](./docker-compose.yaml) file. For development purposes, here are the most important services and how to run them\n- `build_daybreak`\n  - builds the daybreak compiler using the existing bootstrap compiler\n\t- `docker-compose up build_daybreak`\n- `test`\n  - runs the daybreak compiler test suite on the current codebase, bootstrapping the compiler before running the test suite\n\t- `docker-compose up test`\n\n### Native/Local Development\n\nDaybreak currently uses `cc` as the backing C compiler and will fail if this cannot be found.\n\n#### Environment\n\nSkip if using VSCode Dev Containers, for development.\n\nTo develop the compiler locally, these env vars must be set (replacing `/path/to`):\n- `C_INCLUDE_PATH=/path/to/daybreak/src/include:/path/to/daybreak/tests/include`  Defines the include paths for the underlying C compiler\n\n#### Ubuntu\n\n##### GCC (Ubuntu)\n\nIf `gcc` is not installed:\n```bash\nsudo apt update -y\nsudo add-apt-repository -y ppa:ubuntu-toolchain-r/test\nsudo apt install -y gcc-11\ngcc-11 --version # Verifies installation\nsudo update-alternatives --install /usr/bin/gcc gcc $(which gcc-11) 1 # Create /usr/bin/gcc binary if it does not exist, and links gcc-11 to gcc\nsudo update-alternatives --install /usr/bin/cc cc $(which gcc) 1 # Create /usr/bin/cc binary if it does not exist, and links gcc to cc\n# If cc already exists, this may fail and you will need to increment the number at the end of the command to lower the priority.\n# cc should then be explicitly set to the compiler you want\nCC_COMPILER=gcc\nsudo update-alternatives --set cc $(which $CC_COMPILER)\n```\n\n##### Clang (Ubuntu)\n\nIf `clang` is not installed:\n```bash\nsudo apt update -y\nsudo apt install -y clang-11\nclang-11 --version # Verifies installation\nsudo update-alternatives --install /usr/bin/clang clang $(which clang-11) 1 # Create /usr/bin/clang binary if it does not exist, and links clang-11 to clang\nsudo update-alternatives --install /usr/bin/cc cc $(which clang) 1 # Create /usr/bin/cc binary if it does not exist, and links clang to cc\n# If cc already exists, this may fail and you will need to increment the number at the end of the command to lower the priority.\n# cc should then be explicitly set to the compiler you want\nCC_COMPILER=clang\nsudo update-alternatives --set cc $(which $CC_COMPILER)\n```\n\n##### Zig (Ubuntu)\n\nIf `zig` is not installed:\n```bash\nsudo apt update -y\nsudo apt install -y curl\n\nOS=linux\nARCH=x86_64\nZIG_VERSION=0.9.1 # Set version here\nZIG_DIR=zig-${OS}-${ARCH}-${ZIG_VERSION}\nZIG_TARBALL=${ZIG_DIR}.tar.xz\ncurl -O https://ziglang.org/download/${ZIG_VERSION}/${ZIG_TARBALL}\ntar -xvf ${ZIG_TARBALL}\nrm ${ZIG_TARBALL}\nsudo echo \"$(pwd)/${ZIG_DIR}/zig cc \\$@\" \u003e /usr/bin/zig\nsudo chmod +x /usr/bin/zig\n\nsudo update-alternatives --install /usr/bin/cc cc $(which zig) 1 # Create /usr/bin/cc binary if it does not exist, and links zig to cc\n# If cc already exists, this may fail and you will need to increment the number at the end of the command to lower the priority.\n# cc should then be explicitly set to the compiler you want\nCC_COMPILER=zig\nsudo update-alternatives --set cc $(which $CC_COMPILER)\n```\n\n##### WASM (Ubuntu)\n\n`zig` or `clang` can be used to compile WASM files as Daybreak backends with minimal configuration:\n\n###### WASM via Zig\n\nBy modifying `/usr/bin/zig`, we can configure `zig` to compile WASM via wasi. Let's create an intercept compiler script called `zig-wasi`:\n```bash\nsudo echo \"$(pwd)/${ZIG_DIR}/zig cc \\$@\" \u003e /usr/bin/zig-wasi\nsudo chmod +x /usr/bin/zig-wasi\n\nsudo update-alternatives --install /usr/bin/cc cc $(which zig-wasi) 1 # Create /usr/bin/cc binary if it does not exist, and links zig-wasi to cc\n# If cc already exists, this may fail and you will need to increment the number at the end of the command to lower the priority.\n# cc should then be explicitly set to the compiler you want\nCC_COMPILER=zig-wasi\nsudo update-alternatives --set cc $(which $CC_COMPILER)\n```\n\n#### Windows\n\nInstall [MSYS2](https://www.msys2.org/)\n\n##### GCC (Windows)\n\nOnce installed, run the following commands to install all of the dependencies for GCC:\n```bash\npacman -Syu\npacman -Su\npacman -S --needed base-devel mingw-w64-x86_64-toolchain # default=all is correct. ~1 gb of space needed.\n```\n\nAdd `C:\\msys64\\mingw64\\bin` to your `PATH` environment variable.\n\n##### Clang (Windows)\n\n```bash\necho \"???\"\n```\n\n##### Zig (Windows)\n\n```bash\necho \"???\"\n```\n\n#### Mac\n\n##### GCC (Mac)\n\n```zsh\necho \"unsupported\"\n```\n\n##### Clang (Mac)\n\n```zsh\necho \"done\"\n```\n##### Zig (Mac)\n\nIf `zig` is not installed:\n```bash\nOS=macos\nARCH=x86_64 # aarch64 for Apple Silicon\nZIG_VERSION=0.9.1 # Set version here\nZIG_DIR=zig-${OS}-${ARCH}-${ZIG_VERSION}\nZIG_TARBALL=${ZIG_DIR}.tar.xz\ncurl -O https://ziglang.org/download/${ZIG_VERSION}/${ZIG_TARBALL}\ntar -xvf ${ZIG_TARBALL}\nrm ${ZIG_TARBALL}\nsudo echo \"$(pwd)/${ZIG_DIR}/zig cc \\$@\" \u003e /usr/bin/zig\nsudo chmod +x /usr/bin/zig\n\nsudo update-alternatives --install /usr/bin/cc cc $(which zig) 1 # Create /usr/bin/cc binary if it does not exist, and links zig to cc\n# If cc already exists, this may fail and you will need to increment the number at the end of the command to lower the priority.\n# cc should then be explicitly set to the compiler you want\nexport CC_COMPILER=zig\n```\n\n### Build\n\n#### Ubuntu\n\n```bash\n./bootstrap/linux/daybreak ./src/main.day -o ./out/daybreak\n```\n\n#### Windows\n\n```powershell\n.\\bootstrap\\windows\\daybreak.exe .\\src\\main.day -o .\\out\\daybreak.exe\n```\n\n#### Mac\n\n```zsh\n./bootstrap/osx/daybreak ./src/main.day -o ./out/daybreak\n```\n\n#### Mac arm64 (e.g. M1, M2)\n\n```zsh\n./bootstrap/osx/daybreak_arm64 ./src/main.day -o ./out/daybreak_arm64\n```\n\n### Test\n\n#### Ubuntu\n\n```bash\n./bootstrap/linux/daybreak ./tests/test_main.day -o ./out/daybreak_test \u0026\u0026 ./out/daybreak_test\n```\n\n#### Windows\n\n```powershell\n.\\bootstrap\\windows\\daybreak.exe .\\tests\\test_main.day -o .\\out\\daybreak_test.exe \u0026\u0026 .\\out\\daybreak_test.exe\n```\n\n#### Mac\n\n```zsh\n./bootstrap/osx/daybreak ./tests/test_main.day -o ./out/daybreak_test \u0026\u0026 ./out/daybreak_test\n```\n\n#### Mac arm64\n\n```zsh\n./bootstrap/osx/daybreak_arm64 ./tests/test_main.day -o ./out/daybreak_test \u0026\u0026 ./out/daybreak_test\n```\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FExoKomodo%2FDaybreak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FExoKomodo%2FDaybreak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FExoKomodo%2FDaybreak/lists"}