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
77Stellogen is a * logic-agnostic*  programming language based on term unification.
88It 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* .
3359
34- ## Syntax samples  
60+ ## How it works  
3561
36- Finite state machine
62+ The language uses extended S-expressions.
63+ 
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 
3969(new-declaration (spec X Y) (:= X Y)) 
70+ 
71+ ' We define a macro for type assertion 
4072(new-declaration (:: Tested Test) 
4173  (== @(interact @#Tested #Test) ok)) 
4274
75+ ' The type [binary] is defined as a set of three interactive tests 
76+ ' According to the previous macro, the tests passes when interaction gives [ok] 
4377(spec binary { 
4478  [(-i []) ok] 
4579  [(-i [0|X]) (+i X)] 
4680  [(-i [1|X]) (+i X)]}) 
4781
48- 'input words 
82+ ' Encoding of  input words to feed the automaton  
4983(:= e (+i []))        (:: e binary) 
5084(:= 0 (+i [0]))       (:: 0 binary) 
5185(:= 000 (+i [0 0 0])) (:: 000 binary) 
5286(:= 010 (+i [0 1 0])) (:: 010 binary) 
5387(:= 110 (+i [1 1 0])) (:: 110 binary) 
5488
55- ''' 
56- automaton accepting words ending with 00 
57- ''' 
89+ ' We define macros for initial/accepting state and transitions 
90+ ' to make the automaton more readable 
5891(:= (initial Q) [(-i W) (+a W Q)]) 
5992(:= (accept Q) [(-a [] Q) accept]) 
6093(:= (if read C1 on Q1 then Q2) [(-a [C1|W] Q1) (+a W Q2)]) 
6194
95+ ' Definition of the automaton 
6296(:= a1 { 
6397  #(initial q0) 
6498  #(accept q2) 
@@ -67,8 +101,11 @@ automaton accepting words ending with 00
67101  #(if read 1 on q0 then q0) 
68102  #(if read 0 on q1 then q2)}) 
69103
104+ ' Define an expression that cancels terms starting with [-a] 
70105(:= kill (-a _ _)) 
71106
107+ ' Make the automata interact with words and remove unterminated execution paths 
108+ ' Then display the result of interaction 
72109(show (process (interact @#e #a1)   #kill)) 
73110(show (process (interact @#000 #a1) #kill)) 
74111(show (process (interact @#010 #a1) #kill)) 
@@ -86,6 +123,8 @@ To learn more about the current implementation of stellogen:
86123-  French guide (official): https://tsguide.refl.fr/ 
87124-  English guide: https://tsguide.refl.fr/en/ 
88125
126+ For other commands, use the ` --help `  flag at the end of the command.
127+ 
89128# Use  
90129
91130You can either download a
@@ -151,5 +190,3 @@ or if you use Dune:
151190``` 
152191dune exec sgen run -- <inputfile> 
153192``` 
154- 
155- For other commands, use the ` --help `  flag at the end of the command.
0 commit comments