https://github.com/crablang/crab Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} crablang / crab Public * Notifications * Fork 36 * Star 3.3k A community fork of a language named after a plant fungus. All of the memory-safe features you love, now with 100% less bureaucracy! www.crablang.org License Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT 3.3k stars 36 forks Star Notifications * Code * Issues 21 * Pull requests 2 * Discussions * Actions * Projects 2 * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Projects * Security * Insights crablang/crab This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 8 branches 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/c] Use Git or checkout with SVN using the web URL. [gh repo clone crabla] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @EmberHext EmberHext Merge pull request #58 from crablang/update-submodule ... 5630d40 May 29, 2023 Merge pull request #58 from crablang/update-submodule use our crabgo repo as the submodule 5630d40 Git stats * 225,059 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github ci: Add support for dist-loongarch64-linux May 12, 2023 18:31 .reuse Rename config.toml.example to config.example.toml March 11, 2023 14:10 LICENSES clarify the fuchsia code licensing March 9, 2023 12:24 compiler Auto merge of #111235 - loongarch-rs:stabilize-asm, r=Amanieu May 29, 2023 13:31 library Rollup merge of #112045 - Sp00ph:update_current_impl, r=Amanieu May 29, 2023 04:03 src Auto merge of #111235 - loongarch-rs:stabilize-asm, r=Amanieu May 29, 2023 13:31 tests Auto merge of #111748 - nnethercote:Cow-DiagnosticMessage, r= WaffleLa... May 29, 2023 07:10 .editorconfig Add indent_style = tab for Makefiles to .editorconfig April 12, 2023 16:21 .git-blame-ignore-revs Ignore src/bootstrap formatting commit in .git-blame-ignore-revs April 20, 2023 08:45 .gitattributes Rename config.toml.example to config.example.toml March 11, 2023 14:10 .gitignore Auto merge of #108148 - parthopdas:master, r=oli-obk March 20, 2023 03:24 .gitmodules use our crabgo repo as the submodule May 29, 2023 20:32 .mailmap Add Chris Denton to .mailmap April 3, 2023 20:07 CODE_OF_CONDUCT.md Renamed Rust to Crab May 9, 2023 01:03 CONTRIBUTING.md Renamed Rust to Crab May 9, 2023 01:03 COPYRIGHT Update COPYRIGHT file October 30, 2022 10:23 Cargo.lock bump thiserror to use syn 2.0 May 28, 2023 05:38 Cargo.toml create new tool rustdoc-gui-test May 20, 2023 14:40 LICENSE-APACHE Remove appendix from LICENCE-APACHE December 30, 2019 14:25 LICENSE-MIT LICENSE-MIT: Remove inaccurate (misattributed) copyright notice July 26, 2017 16:51 README.md add install script to readme April 25, 2023 16:17 RELEASES.md Merge pull request #57 from crablang/current May 29, 2023 20:32 config.example.toml support enable rpath in each target independently May 5, 2023 17:46 configure Enforce Python 3 as much as possible April 10, 2020 09:09 rustfmt.toml Change src/test to tests in source files, fix tidy and tests January 11, 2023 09:32 sync-upstream.sh add force push May 23, 2023 11:09 triagebot.toml Auto merge of #111348 - ozkanonur:remove-hardcoded-rustdoc-flags, r= a... May 27, 2023 04:20 x check bootstrap scripts syntax May 3, 2023 20:32 x.ps1 Rollup merge of #111151 - ozkanonur:syntax-check-on-bootstrap-scripts... May 6, 2023 23:32 x.py Make x.py work again in most (all?) cases May 1, 2023 16:20 View code [ ] The Crab Programming Language Quick Start Installing from Source Dependencies Building on a Unix-like system Building on Windows MinGW MSVC Specifying an ABI Configure and Make Building Documentation Notes Getting Help Contributing License Trademark README.md [231858967-7c37bf1e-335b-4f5] The Crab Programming Language CrabLang Community This is the main source code repository for Crab. It contains the compiler, standard library, and documentation. Note: this README is for users rather than contributors. If you wish to contribute to the compiler, you should read CONTRIBUTING.md instead. Quick Start To get started with the renamed CrabLang toolchain, run the following: sh <(curl https://install.crablang.org -L) * currently Unix only Installing from Source The Crab build system uses a Python script called x.py to build the compiler, which manages the bootstrapping process. It lives at the root of the project. The x.py command can be run directly on most Unix systems in the following format: ./x.py [flags] This is how the documentation and examples assume you are running x.py. Some alternative ways are: # On a Unix shell if you don't have the necessary `python3` command ./x [flags] # On the Windows Command Prompt (if .py files are configured to run Python) x.py [flags] # You can also run Python yourself, e.g.: python x.py [flags] More information about x.py can be found by running it with the --help flag or reading the crabc dev guide. Dependencies Make sure you have installed the dependencies: * python 3 or 2.7 * git * A C compiler (when building for the host, cc is enough; cross-compiling may need additional compilers) * curl (not needed on Windows) * pkg-config if you are compiling on Linux and targeting Linux * libiconv (already included with glibc on Debian-based distros) To build Crabgo, you'll also need OpenSSL (libssl-dev or openssl-devel on most Unix distros). If building LLVM from source, you'll need additional tools: * g++, clang++, or MSVC with versions listed on LLVM's documentation * ninja, or GNU make 3.81 or later (Ninja is recommended, especially on Windows) * cmake 3.13.4 or later * libstdc++-static may be required on some Linux distributions such as Fedora and Ubuntu On tier 1 or tier 2 with host tools platforms, you can also choose to download LLVM by setting llvm.download-ci-llvm = true. Otherwise, you'll need LLVM installed and llvm-config in your path. See the crabc-dev-guide for more info. Building on a Unix-like system 1. Clone the source with git: git clone https://github.com/crablang/crab.git cd crab 2. Configure the build settings: The CrabLang build system uses a file named config.toml in the root of the source tree to determine various configuration settings for the build. Set up the defaults intended for distros to get started. You can see a full list of options in config.example.toml. printf 'profile = "user" \nchangelog-seen = 2 \n' > config.toml If you plan to use x.py install to create an installation, it is recommended that you set the prefix value in the [install] section to a directory. 3. Build and install: ./x.py build && ./x.py install When complete, ./x.py install will place several programs into $PREFIX/bin: crabc, the CrabLang compiler, and crablangdoc, the API-documentation tool. If you've set profile = "user" or build.extended = true, it will also include Crabgo, CrabLang's package manager. Building on Windows On Windows, we suggest using winget to install dependencies by running the following in a terminal: winget install -e Python.Python.3 winget install -e Kitware.CMake winget install -e Git.Git Then edit your system's PATH variable and add: C:\Program Files\CMake \bin. See this guide on editing the system PATH from the Java documentation. There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by Visual Studio and the GNU ABI used by the GCC toolchain. Which version of CrabLang you need depends largely on what C/C++ libraries you want to interoperate with. Use the MSVC build of CrabLang to interop with software produced by Visual Studio and the GNU build to interop with GNU software built using the MinGW/MSYS2 toolchain. MinGW MSYS2 can be used to easily build CrabLang on Windows: 1. Download the latest MSYS2 installer and go through the installer. 2. Run mingw32_shell.bat or mingw64_shell.bat from the MSYS2 installation directory (e.g. C:\msys64), depending on whether you want 32-bit or 64-bit CrabLang. (As of the latest version of MSYS2 you have to run msys2_shell.cmd -mingw32 or msys2_shell.cmd -mingw64 from the command line instead.) 3. From this terminal, install the required tools: # Update package mirrors (may be needed if you have a fresh install of MSYS2) pacman -Sy pacman-mirrors # Install build tools needed for CrabLang. If you're building a 32-bit compiler, # then replace "x86_64" below with "i686". If you've already got Git, Python, # or CMake installed and in PATH you can remove them from this list. # Note that it is important that you do **not** use the 'python2', 'cmake', # and 'ninja' packages from the 'msys2' subsystem. # The build has historically been known to fail with these packages. pacman -S git \ make \ diffutils \ tar \ mingw-w64-x86_64-python \ mingw-w64-x86_64-cmake \ mingw-w64-x86_64-gcc \ mingw-w64-x86_64-ninja 4. Navigate to CrabLang's source code (or clone it), then build it: ./x.py build && ./x.py install MSVC MSVC builds of CrabLang additionally require an installation of Visual Studio 2017 (or later) so crabc can use its linker. The simplest way is to get Visual Studio, check the "C++ build tools" and "Windows 10 SDK" workload. (If you're installing CMake yourself, be careful that "C++ CMake tools for Windows" doesn't get included under "Individual components".) With these dependencies installed, you can build the compiler in a cmd.exe shell with: python x.py build Right now, building CrabLang only works with some known versions of Visual Studio. If you have a more recent version installed and the build system doesn't understand, you may need to force crablangbuild to use an older version. This can be done by manually calling the appropriate vcvars file before running the bootstrap. CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" python x.py build Specifying an ABI Each specific ABI can also be used from either environment (for example, using the GNU ABI in PowerShell) by using an explicit build triple. The available Windows build triples are: * GNU ABI (using GCC) + i686-pc-windows-gnu + x86_64-pc-windows-gnu * The MSVC ABI + i686-pc-windows-msvc + x86_64-pc-windows-msvc The build triple can be specified by either specifying --build= when invoking x.py commands, or by creating a config.toml file (as described in Installing from Source), and modifying the build option under the [build] section. Configure and Make While it's not the recommended build system, this project also provides a configure script and makefile (the latter of which just invokes x.py). ./configure make && sudo make install configure generates a config.toml which can also be used with normal x.py invocations. Building Documentation If you'd like to build the documentation, it's almost the same: ./x.py doc The generated documentation will appear under doc in the build directory for the ABI used. That is, if the ABI was x86_64-pc-windows-msvc, the directory will be build\ x86_64-pc-windows-msvc\doc. Notes Since the CrabLang compiler is written in CrabLang, it must be built by a precompiled "snapshot" version of itself (made in an earlier stage of development). As such, source builds require an Internet connection to fetch snapshots, and an OS that can execute the available snapshot binaries. See https://doc.crablang.org/nightly/crabc/platform-support.html for a list of supported platforms. Only "host tools" platforms have a pre-compiled snapshot binary available; to compile for a platform without host tools you must cross-compile. You may find that other platforms work, but these are our officially supported build environments that are most likely to work. Getting Help Need help? Join us on discord at https://community.crablang.org! Contributing See CONTRIBUTING.md. License CrabLang is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses. See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details. Trademark If you want to use any names or brands associated with Crab or CrabLang, please feel free to do so in any capacity. Third-party logos may be subject to third-party copyrights and trademarks. See Licenses for details. About A community fork of a language named after a plant fungus. All of the memory-safe features you love, now with 100% less bureaucracy! www.crablang.org Resources Readme License Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT Code of conduct Code of conduct Stars 3.3k stars Watchers 18 watching Forks 36 forks Report repository Releases No releases published Packages 0 No packages published Contributors 4,818 * @bors * @matklad * @bors[bot] * @RalfJung * @brson * @matthiaskrgr * @alexcrichton * @GuillaumeGomez * @oli-obk * @Centril * @nikomatsakis + 4,807 contributors Languages * Rust 96.9% * Shell 0.5% * JavaScript 0.4% * Python 0.4% * Fluent 0.4% * HTML 0.3% * Other 1.1% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.