Skip to content

Commit 59051d3

Browse files
authored
Merge pull request #128 from engboris/doc
Update README
2 parents debf3f9 + 8e7815f commit 59051d3

37 files changed

+76
-2107
lines changed

README.md

Lines changed: 76 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,95 @@
11
# Stellogen
22

3-
**Note: this project is an experimental proof of concept, not a fully
4-
designed or specified programming language. It is better understood as a
5-
research project or an esoteric language.**
3+
Stellogen is an experimental, "logic agnostic" language that asks: what if
4+
programs and their meaning were built from the same raw material, term
5+
unification, without types or logic imposed from above?
66

77
Stellogen is a *logic-agnostic* programming language based on term unification.
88
It has been designed from concepts of Girard's transcendental syntax.
99

10+
Stellogen explores a different way of thinking about programming languages:
11+
instead of relying on primitive types or fixed logical rules, it is built on
12+
the simple principle of term unification. The goal is not to replace existing
13+
languages, but to test how far this idea can be pushed and what new programming
14+
paradigms might emerge from it.
15+
16+
**For the moment, it is an experimental proof of concept, not a fully
17+
designed or specified programming language. It is better understood as a
18+
research project or an esoteric language.**
19+
20+
## Philosophy
21+
22+
Programs exist to solve needs, but they don’t always behave as expected. To
23+
reduce this gap, we use a separate formal language of types. Types act like
24+
**questions** we can ask, and programs act as **answers**.
25+
26+
This language of types is powerful, but it also shapes and constrains the way
27+
we design programs. It defines which questions are even possible to ask. Typed
28+
functional languages, dependent types, and other formal systems provide
29+
remarkable guarantees, but they also impose a logic you must follow, even when
30+
you might prefer to proceed more directly, or even outside of such a system.
31+
32+
Stellogen takes another path. It offers elementary interactive building blocks
33+
where both computation and meaning live in the same language. In this setting,
34+
compilers and interpreters no longer carry semantic authority: their role is
35+
only to check that blocks connect. The semantic power (and the responsibility
36+
that comes with it) belongs entirely to the user.
37+
1038
## Key characteristics
1139

12-
- **typable** but without primitive types nor type systems
13-
- both computation and typing are based on basic **term unification** between
14-
blocks of terms.
40+
- Programs are **typable**, but without primitive types or predefined type
41+
systems;
42+
- Both computation and typing rely on the same mechanism: **term unification**.
43+
- It is multi-paradigm:
1544

16-
It is multi-paradigm:
17-
- _logic programs_ called "constellations" are the elementary blocks of
18-
programming;
19-
- _functional programs_ correspond to layered constellations enforcing an order
20-
of interaction;
21-
- _imperative programs_ are iterative recipes constructing constellations;
22-
- _objects_ are ways to structure constellations.
45+
| Paradigm | Stellogen equivalent |
46+
| --------------- | ---------------------------------------------------------|
47+
| Logic | Constellations (elementary blocks) |
48+
| Functional | Layered constellations enforcing order of interaction |
49+
| Imperative | Iterative recipes for building constellations |
50+
| Object-oriented | Structured constellations |
2351

2452
## Influences
2553

26-
It draws (or try to draw) inspiration from:
27-
- Prolog/Datalog (for unification-based computation and constraint solving);
28-
- Smalltalk (for message-passing, object-oriented paradigm and minimalism);
29-
- Coq (for proof-as-program paradigm and iterative programming with tactics);
30-
- Scheme/Racket (for minimalism and metaprogramming);
31-
- Shen (for its optional type systems and its "power and responsibility"
32-
philosophy).
54+
Stellogen borrows ideas from several traditions: from **Prolog/Datalog** for
55+
the power of unification; from **Smalltalk** for the minimalism of
56+
message-passing and objects; from **Rocq** for the proof-as-program paradigm;
57+
from **Scheme/Racket** for the spirit of metaprogramming; and from **Shen** for
58+
the philosophy of optional type systems where *power comes with responsibility*.
59+
60+
## How it works
3361

34-
## Syntax samples
62+
The language uses extended S-expressions.
3563

36-
Finite state machine
64+
Here is a commented example of the definition of a finite state machine
65+
accepting words ending with `00`.
3766

3867
```
68+
' We define a macro 'spec' for type definition
69+
' It is just an alias for the definition [:=]
3970
(new-declaration (spec X Y) (:= X Y))
71+
72+
' We define a macro for type assertion
4073
(new-declaration (:: Tested Test)
41-
(== @(interact @#Tested #Test) ok))
74+
(== @(interact @#Tested #Test) ok)) ' triggers interaction and expects [ok]
4275
76+
' The type [binary] is defined as a set of three interactive tests
77+
' According to the previous macro, the tests pass when interaction gives [ok]
4378
(spec binary {
44-
[(-i []) ok]
45-
[(-i [0|X]) (+i X)]
46-
[(-i [1|X]) (+i X)]})
47-
48-
'input words
49-
(:= e (+i [])) (:: e binary)
50-
(:= 0 (+i [0])) (:: 0 binary)
51-
(:= 000 (+i [0 0 0])) (:: 000 binary)
52-
(:= 010 (+i [0 1 0])) (:: 010 binary)
53-
(:= 110 (+i [1 1 0])) (:: 110 binary)
54-
55-
'''
56-
automaton accepting words ending with 00
57-
'''
58-
(:= (initial Q) [(-i W) (+a W Q)])
59-
(:= (accept Q) [(-a [] Q) accept])
60-
(:= (if read C1 on Q1 then Q2) [(-a [C1|W] Q1) (+a W Q2)])
61-
62-
(:= a1 {
63-
#(initial q0)
64-
#(accept q2)
65-
#(if read 0 on q0 then q0)
66-
#(if read 0 on q0 then q1)
67-
#(if read 1 on q0 then q0)
68-
#(if read 0 on q1 then q2)})
69-
70-
(:= kill (-a _ _))
71-
72-
(show (process (interact @#e #a1) #kill))
73-
(show (process (interact @#000 #a1) #kill))
74-
(show (process (interact @#010 #a1) #kill))
75-
(show (process (interact @#110 #a1) #kill))
79+
[(-i []) ok] ' returns [ok] on empty list
80+
[(-i [0|X]) (+i X)] ' matches on [0] and checks the tail
81+
[(-i [1|X]) (+i X)]}) ' matches on [1] and checks the tail
82+
' otherwise the term remains unchanged
83+
84+
' We define some words
85+
(:= word1 (+i [0 1 1]))
86+
(:= word2 (+i [2 3]))
87+
88+
' succeeds -> [ok] is obtained on interaction with test [binary]
89+
(:: word1 binary)
90+
91+
' fails
92+
' (:: word2 binary)
7693
```
7794

7895
More examples can be found in `examples/`.
@@ -83,8 +100,10 @@ This project is still in development, hence the syntax and features
83100
are still changing frequently.
84101

85102
To learn more about the current implementation of stellogen:
86-
- French guide (official): https://tsguide.refl.fr/
87-
- English guide: https://tsguide.refl.fr/en/
103+
104+
https://github.com/engboris/stellogen/wiki/Basics-of-Stellogen
105+
106+
A more complete guide is in production.
88107

89108
# Use
90109

guide/en/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

guide/en/Makefile

Lines changed: 0 additions & 7 deletions
This file was deleted.

guide/en/book.toml

Lines changed: 0 additions & 6 deletions
This file was deleted.

guide/en/src/SUMMARY.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

guide/en/src/imperative/processes.md

Lines changed: 0 additions & 70 deletions
This file was deleted.

guide/en/src/introduction/introduction.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)