How to Install Carbon Language in Ubuntu and First Steps
Carbon is the new programming language from Google, Open Source that intends to be the successor to C++.
Carbon, or Carbon-Lang, is an experimental, general-purpose programming language.
The project is open-source and was started by Google, following in the footsteps of previous Google-made programming languages (Go and Dart). Google engineer Chandler Carruth first introduced Carbon at the CppNorth conference in Toronto in July 2022. He stated that Carbon was created to be a C++ successor.
The language is expected for a 1.0 release to occur in 2024 or 2025. The language intends to fix several perceived shortcomings of C++ but otherwise provides a similar feature set.
The main goals of the language are readability and “bi-directional interoperability”, as opposed to using a new language like Rust (which, while being based on C++, is not two-way compatible with C++ programs). Changes to the language will be decided by the Carbon leads.
Carbon’s documents, design, implementation, and related tools are hosted on GitHub under the Apache-2.0 license with LLVM Exception.
01. Update the system:
02. Install the necessary dependencies:
03. Install Homebrew:
04. Load the Homebrew environment:
05. Install packages with Homebrew:
06. Update PIP and add
llvm to the
07. Clone and run Carbon:
08. ‘Hello, World!’ in carbon
To compile, run:
bazel run //explorer -- ./explorer/testdata/print/sandbox.carbon
09. Declaring variables:
10. Basics for
11. Creating functions without parameters:
12. Declaring functions with parameters
If you want, try using Carbon online at: https://carbon.godbolt.org/.