A community fork of a language named after a plant fungus

Related tags

Command-line crab
Overview

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

!TODO

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 <subcommand> [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 <subcommand> [flags]

# On the Windows Command Prompt (if .py files are configured to run Python)
x.py <subcommand> [flags]

# You can also run Python yourself, e.g.:
python x.py <subcommand> [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
  1. 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.

    config.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.

  2. 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.

Comments
  • Rename Cargo to Crusty

    Rename Cargo to Crusty

    Rename cargo to crusty. Now we have crusty building the crab language. May or may not be inspired by some yellow square with the last name Robert or something 🟨 :)

    Update 1

    Ok so there are 2 current popular proposals:

    Spongebob Theme:

    cargo -> crusty or krusty rust -> crab rustc -> crabc rustfmt -> crabfmt clippy -> fiddler crate -> patty

    Crab Theme:

    cargo -> crabgo rust -> crab rustc -> crabc rustfmt -> crabfmt clippy -> crabby crate -> barrel, cage, idk. I haven't seen any crab[some term here] for this one yet.

    I know I proposed the Spongebob theme, but I'm actually leaning towards the crab theme for simplicity and easy to remember commands / tools.

    BUT

    I propose that if we go with the crab theme, we include an easter egg:

    crabgo sponge

    It will alias all tools / commands to sponge bob related things :)

    I'll keep updating this as we make progress with the discussion around the issue :). If anyone has any ideas for a crate -> crab[something] post below! :)

    opened by TCROC 21
  • Use .cr file extension

    Use .cr file extension

    The original language that should not be named uses .rs as its file extension.

    Crablang should use .cr as file extension.

    Incidentally, there exists a .cr TLD.

    So in the same way that people have been using .rs TLD with the original language that should not be named. https://en.wikipedia.org/wiki/.rs

    Users of Crablang could use the .cr TLD. https://en.wikipedia.org/wiki/.cr

    opened by o-agassizii 6
  • Can I use crab logo?

    Can I use crab logo?

    Hello sirs, thank you for the fork. It is a very nice fork and I am looking to incorporate it into my daily programming but I like to use the logo for purposes related to microblogging and was wondering if it was ok? Is it ok to edit the logo to a theme too?

    opened by WOOB4T 2
  • Creative Commons / MIT / Apache License Everything

    Creative Commons / MIT / Apache License Everything

    Make sure crab, crablang, crusty, crabby, or whatever we decided to call our tools and terminology are licensed as openly as possible. We want to make sure nobody takes them away from us.

    opened by TCROC 2
  • Some ideas for a sublanguage

    Some ideas for a sublanguage

    Here, a sublanguage that implements breaking changes to crab is being discussed. I decided to create a list of the things I would like to see in such a sublanguage:

    • A C-style entry point. I would like to see main() provide argv, and
    • a simpler io::Error; this could be implemented by allowing main() to return a std::io::Result<(), String> or something else.
    • A stable ABI
    • LGPL-3.0-or-later-licensed standard/core library, AGPL-3.0-or-later-licensed compiler toolchain. *
    • Proper source file license and copyright notices **

    * The LGPL would preserve the freedom of the library without implicitly licensing anything linked against it as copyleft, therefore allowing crab to be used in permissively-licensed projects as well as nonfree ones. Changes to the library itself would be copylefted, though. The AGPL would specifically apply in any case where the compiler is used over a network, requiring any forks of crab to provide ways to access its source code. Otherwise, it’s the same as the GPL.

    ** License notices are an important part of software licensing that goes mostly ignored by even the likes of the upstream project, and they don’t just apply for the GPL family of licenses.

    Please add anything more here that you’d like to see in crab :)

    opened by emmatebibyte 8
  • Toolchain

    Toolchain

    We need to set up a functional toolchain with the renamed tools. This will help ease the transition and is the fastest way to get people using Crab. We need to figure out the best way to go about this, what repos we need to fork, etc…

    opened by trvswgnr 1
  • lack of a trademark policy update

    lack of a trademark policy update

    Summary

    I'm the head of the "Crablang foundation", and we are developing an updated Trademark Policy for use of the registered trademarks Crablang and Crusty. We began this legal process collaboratively in April 2023, starting with the Trademark Policy Review Survey, which received nearly some pretty few responses.

    opened by merouanezouaid 3
STKLR is a tool to help you automatically link up named stuff in your rust docs!

_____ _______ _ ___ _____ / ____|__ __| |/ / | | __ \ | (___ | | | ' /| | | |__) | \___ \ | | | < | | | _ / ___

Jer 3 Oct 25, 2022
A community improved version of the polycubes project!

Polycubes This code is associated with the Computerphile video on generating polycubes. The original repository may be found here. That version is unc

Michael Pound 30 Jul 26, 2023
A fork of V8Js re-implemented in Rust

PHP-V8Js PHP-V8Js is a PHP extension for the V8 JavaScript engine. It is a re-implementation of the fantastic (though unmaintained) V8Js PHP extension

Joe Hoyle 13 Jan 2, 2023
Fork of the Official Python3 API connector for Bybit's HTTP (bybit) and WebSockets APIs to rust

Fork of pybit python libary in Rust For the rust lovers and creators for bybit exchange version 5 Official Python3 API connector for Bybit's HTTP and

Omambia Dauglous 4 Aug 29, 2023
The Amp programming language: a language designed for building high performance systems.

A language designed for building high performance systems. Platform Support x86_64-pc-windows ✅ x86_64-unknown-linux ⚠️ untested x86_64-unknown-darwin

The Amp Programming Language 5 Mar 17, 2023
An Interpreter for Brainfuck programming language implemented in the Rust programming language with zero dependencies.

Brainfuck Hello, Visitor! Hey there, welcome to my project showcase website! It's great to have you here. I hope you're ready to check out some awesom

Syed Vilayat Ali Rizvi 7 Mar 31, 2023
Nexa programming language. A language for game developers by a game developer

NexaLang Nexa programming language. A language for game developers by a game developer. Features High-Level: Nexa is an easy high level language Two M

Sabe 3 Aug 21, 2023
A Text User Interface library for the Rust programming language

Cursive Cursive is a TUI (Text User Interface) library for rust. It uses ncurses by default, but other backends are available. It allows you to build

Alexandre Bury 3.3k Jan 9, 2023
Voila is a domain-specific language launched through CLI tool for operating with files and directories in massive amounts in a fast & reliable way.

Voila is a domain-specific language designed for doing complex operations to folders & files. It is based on a CLI tool, although you can write your V

Guillem Jara 86 Dec 12, 2022
Standard Graphics is a command-line tool for printing 2D graphics from any language to any screen.

2D graphics in any programming language with just print statements!

Caleb Winston 123 Nov 20, 2022
Text-based to-do management CLI & language server

☑️ Todome (日本語版はこちら) Todome is a notation developed for making and editing to-do lists. It is inspired by Todo.txt, and in fact some of the todome not

monaqa 16 Aug 17, 2022
An elegant language for script-kiddies and terminal squatters.

Tonic An elegant language for script-kiddies and terminal squatters. About I started Tonic to complete the Advent of Code 2021. My eventual goal is to

Ryan Chandler 12 Nov 22, 2022
A diff-based data management language to implement unlimited undo, auto-save for games, and cloud-apps which needs to retain every change.

Docchi is a diff-based data management language to implement unlimited undo, auto-save for games, and cloud-apps which needs to save very often. User'

juzy 21 Sep 19, 2022
Rust-language assets for Zcash

Zcash Rust crates This repository contains a (work-in-progress) set of Rust crates for working with Zcash. Security Warnings These libraries are curre

Zcash 273 Jan 3, 2023
🎄My Advent of Code 2021 solutions in the Rust programming language

Advent of Code 2021 in Rust My Advent of Code 2021 solutions in the Rust programming language. This repository holds a separate Rust project for each

Tim Visée 227 Dec 16, 2022
Yfin is the Official package manager for the Y-flat programming language

Yfin is the Official package manager for the Y-flat programming language. Yfin allows the user to install, upgrade, and uninstall packages. It also allows a user to initialize a package with the Y-flat package structure and files automatically generated. In future, Yfin will also allow users to publish packages.

Jake Roggenbuck 0 Mar 3, 2022
A Text User Interface library for the Rust programming language

Cursive Cursive is a TUI (Text User Interface) library for rust. It uses ncurses by default, but other backends are available. It allows you to build

Alexandre Bury 3.3k Jan 3, 2023
Notes on learning the Rust programming language syntax.

notes-on-rust Notes on learning the Rust programming language syntax. Resources https://www.rust-lang.org/learn/get-started https://doc.rust-lang.org/

Fred Snyder 1 Jan 2, 2022
A clone of linux cal command, using rust programming language

CLI Calendar command What the project does This command was inspired by Linux Cal command that shows the current month calendar as output (by default)

Mohamed Djoudi Benarfa 2 Nov 16, 2022