Skip to content

Commit ccdcb6f

Browse files
committed
write language overview
1 parent 87eede5 commit ccdcb6f

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

content/overview.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
+++
2+
description = "Cation Language Overview"
3+
template = "page.html"
4+
+++
5+
6+
# Cation Language Overview
7+
8+
Cation as a pure categorical programming language for practical tasks.
9+
10+
We designed Cation to be:
11+
- non-verbose;
12+
- as close to mathematics notation as possible;
13+
- extensible and usable for creation of domain-specific languages.
14+
15+
## Unique features
16+
17+
### Boundness
18+
19+
Cation is the first and the only language where *all types are bounded in their size and computational resources at the
20+
compile time*. This enables two main core language properties: *formal verifiability* and *termination analysis*. It
21+
also makes Cation a language which can be used for writing ubiquitous deterministic programs suitable for mathematical
22+
modelling and immutable smart contracts.
23+
24+
<aside>
25+
<h3>Why not to use existing functional language?</h3>
26+
27+
<p>Since each one of them lacks the distinguishing features: absence of the non-terminating computations and parallelism
28+
by default.</p>
29+
30+
<p>Instead of operating with a pure mathematical abstractions, which may frequent lead to paradoxes with no physical
31+
meaning (like <a href="https://en.wikipedia.org/wiki/Banach%E2%80%93Tarski_paradox"></a>Banach–Tarski paradox</a>),
32+
Cation assumes real physical model for the computing: there are no infinities; any computation is always bound in its
33+
resources. This allows Cation to achieve things which can't be achieved with any other existing language,
34+
functional or not.</p>
35+
</aside>
36+
37+
By types being *bound* we mean that any type is a finite set of a known size, with all possible values known to the
38+
compiler.
39+
40+
- Only two foundational types: unit (initial object) and uninhabitable type (empty set or a terminal object);
41+
- All integers are enumerations made with unit type (Peano arithmetics);
42+
- All rational numbers, including rational numbers (like results of division of integers),
43+
arithmetic reals (like square root of 2) and irrational numbers (like *pi* or *e*) are explicit
44+
decimal approximates expressed as functions running for a number of steps known at compile-time;
45+
- All other types are composed as a product or co-product categories from unit and uninhabitable type;
46+
- Dynamic collections and iterators always have bounds on the minimum and maximal number of elements enforced at
47+
compile-time;
48+
- There is no bottom type (non-terminating computations).
49+
50+
### Parallelism by default
51+
52+
Cation compiller converts a program as a set of expressions into a composition of natural transformations. This allows
53+
static analysis at compile-time of which branches of computations depends on which values from other branches; the
54+
compiler uses this information to parallize all computing wherever is possible with no programmer or syntax overhead.
55+
56+
When needed, a developer can use an explicit parallelism using asynchronous channels, avoiding racing conditions. These
57+
channels can be used to send values, lambda-functions and even other channels between execution threads using
58+
rho-calculus: an extension of lambda-calculus for parallel computations.
59+
60+
### No RAM, no mutability
61+
62+
- Absence of mutable variables;
63+
- Abstracted memory management: language is suitable for architectures with no RAM access, like memristors and cellular
64+
automation;
65+
66+
## Notable features
67+
68+
- Generic system
69+
- Collections
70+
- Iterators
71+
- Collection comprehensions
72+
- Extensible set of literals
73+
- Domain-specific languages
74+
- No runtime
75+
- Tiny set of compiler built-ins
76+
- Moands
77+
- Side-effect control
78+
- Termination analysis
79+
- Extensible infix operators
80+
- Close-to-mathematics
81+
82+
## Syntax
83+
84+
### Declarations
85+
86+
Cation has only two keywords: `type`, for defining a type, and `val`, for instantiating a value.

0 commit comments

Comments
 (0)