
C2 Programming Language
In a language like C or C2, the language offers you basic constructs to work with, so you're much more focused on solving the actual problem: a higher development speed. The idea that a higher-level language makes development faster only works for a 'lot-higher' languages like Python, not for C++/Rust that aren't really a lot 'higher'.
C2 Language Documentation
C2 aims to be the programming language of choice for situations where C would currently be used. Low-level programs like bootloaders, kernels, drivers and system-level tooling are what C2 was designed for.
Evolution - C2 Language Documentation
In C2 the developer can choose between 2 modes: single module or multiple modules. In multi-modules mode (the default), all source files within the same C2 module are turned into a single LLVM module (see below).
Hello World - C2 Language Documentation
hello.c2 module hello_world; import stdio as io; fn i32 main(i32 argc, char** argv) { io.printf("Hello World!\n"); return 0; } Spot the six differences from C: Scroll down for the answer
- [PDF]
C2 language
The C programming language has been around for a long time and is still used a lot nowadays. The core of the language is very solid, but other aspects are showing their age. C2 attempts to modernize these parts, while keeping the feel of C. It should be seen as an evolution of C. Bas van den Berg C2 language 2014 3 / 37
External Libraries - C2 Language Documentation
C2 is an evolution of C. So one design criterion would be easy integration with existing C libraries. This section explains how C2 integrates external C libraries. C/C++ library support. Let's start this section by first looking at existing library support in C (or C++). The first thing to realize is: C does not have true library support!
Basic types - C2 Language Documentation
C2 has the following built-in primitive types: bool: Either true or false. i8, i16, i32, i64: Signed integral types. u8, u16, u32, u64: Unsigned integral types. isize, usize: architecture dependent, either i32/i64 or u32/u64. f32, f64: Single and double precision floating point types, respectively.
Modules - C2 Language Documentation
Like many other modern languages, C2 utilises the concept of modules. Modules are used to create logical groups of functions, types and variables. Each .c2 file must begin with the module keyword, specifying which module it belongs to. A module can consist of several files, for example: file1.c2. module foo; // .. file2.c2. module foo ...
Intro - C2 Language Documentation
The scope of C2 language is larger than just the code itself; it also includes the build system. Including this allows doing many nice things easily, like LTO (link time optimization), etc. The C2 build system uses two different configuration files: the recipe and the build file .
Naming - C2 Language Documentation
Unlike many other languages, C2 enforces the way the elements of the language are named. This is done to unify coding styles and make it easier to read the code. Currently only the first character of a name is enforced as either Upper-cased …