Skip to content

A C-like type-, memory- and thread-safe systems programming language with zero-cost object-orientation

License

Unlicense and 2 other licenses found

Licenses found

Unlicense
UNLICENSE
GFDL-1.3
LICENSE.FDL
GPL-3.0
LICENSE.GPL
Notifications You must be signed in to change notification settings

calcium-lang/spec

Calcium

A C-like type-, memory- and thread-safe systems programming language with zero-cost object-orientation.

License

Copyright (c)  2021-2023  Natan Junges.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".

The lexicon and syntax files are licensed under the GNU General Public License v3.

The code snippets are licensed under the Unlicense.

Building

To build the most recent Syntax.md file, first make sure you have Alchemist's front-end library and cog installed:

git clone https://github.com/alchemist-compiler/front.git alchemist-front
pip3 install cogapp

Once you have installed all requirements, run:

cog -I./:./alchemist-front -r Syntax.md

Index

  1. Packages
  2. Names
  3. Typedefs, Enums, Unions and Structs
  4. Types
  5. Blocks and Statements
  6. Expressions
  7. Array and Struct Initializers
  8. Syntax
  9. Syntax (source code)
  10. Lexicon (source code)

Introduction

It is heavily inspired by C, and tries to support all its features. It is also inspired by Java, and implements a subset of its object-orientation model, while trying to remove the space- and time-costs of such abstractions. Some of its syntax is inspired by Kotlin, Python, JavaScript/TypeScript and Rust.

Its name is after the chemical element Calcium(Ca), the third most abundant metal in Earth's crust and the main component of bones, the structural support of all vertebrates. It was chosen because it evokes solidity and stability, concepts that fit well with systems development.

Design Principles

In decreasing order of importance:

  1. Type-safety
  2. Memory-safety
  3. Thread-safety
  4. Suckless philosophy
  5. Keep it simple stupid
  6. Principle of least astonishment
  7. Gang of Four Design Patterns
  8. C interoperability
  9. Runtime space efficiency
  10. Runtime time efficiency
  11. Binary size efficiency