Commit ef195ae9594a984c543fbcd51680cecff1766ca8

Thomas de Grivel 2024-10-14T17:14:30

doc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
diff --git a/doc/1_KC3/1.1_Introduction.en.md b/doc/1_KC3/1.1_Introduction.en.md
index 6f6af20..81b06f5 100644
--- a/doc/1_KC3/1.1_Introduction.en.md
+++ b/doc/1_KC3/1.1_Introduction.en.md
@@ -26,7 +26,7 @@ and is named with a symbol starting with a uppercase character.
 For instance `Sym` and `Str` are valid module names.
 
 Use defmodule to define a module. Example :
-```
+```elixir
 defmodule Test do
   def one = 1
   def double = fn (x) { x * 2 }
@@ -39,7 +39,7 @@ type name if the corresponding module defines a type.
 
 Use defstruct to define a struct type in a module. The struct will have
 the same name as the module. Example :
-```
+```elixir
 ikc3> defmodule Test do
 ikc3>   defstruct [x: (F32) 0.0,
 ikc3>              y: (F32) 0.0]
@@ -91,6 +91,8 @@ Basic data types in KC3 are :
 
 ---
 
+Top : [KC3 documentation](/doc/)
+
 Previous : [1 KC3](/doc/1_KC3)
 
 Next : [1.2 Integer](1.2_Integer)
diff --git a/doc/1_KC3/1.2_Integer.en.md b/doc/1_KC3/1.2_Integer.en.md
index 0858b38..35c7c18 100644
--- a/doc/1_KC3/1.2_Integer.en.md
+++ b/doc/1_KC3/1.2_Integer.en.md
@@ -17,7 +17,7 @@ not as a pointer, and for these reasons are fast.
 They do not need to be cleaned after use and thus can be used in arrays like
 is usually done in C.
 
-```
+```elixir
 ikc3> type(-1)
 S8
 ikc3> type(-128)
@@ -47,7 +47,7 @@ Their type is `Integer` and can support numbers as large as memory allows.
 They are slow because they are allocated dynamically on the heap
 using malloc.
 
-```
+```elixir
 ikc3> type(1000000000000000000000000000000)
 Integer
 ```
@@ -59,7 +59,7 @@ Integer
 
 Binary not.
 
-```
+```elixir
 ikc3> ~ 1
 254
 ikc3> ~ -1
@@ -81,7 +81,7 @@ Integer addition.
 All positive integers can be defined in terms of addition of :
 zero or a positive integer, and one. E.g.
 
-```
+```elixir
 1 = 0 + 1
 2 = 0 + 1 + 1
 3 = 0 + 1 + 1 + 1
@@ -114,7 +114,7 @@ Left shift
 
 ## 1.2.4 Examples
 
-```
+```elixir
 ikc3> type(1)
 U8
 ikc3> type(1000000000000000000000000000000)
@@ -129,6 +129,8 @@ ikc3> a * a / 1000000000000000000000000000000000000000000000000000
 
 ---
 
+Top : [KC3 documentation](/doc/)
+
 Previous : [1.1 Introduction](1.1_Introduction)
 
 Next : [1.3 Map](1.3_Map)
diff --git a/doc/1_KC3/1.3_Map.en.md b/doc/1_KC3/1.3_Map.en.md
index e01b71c..9a09d14 100644
--- a/doc/1_KC3/1.3_Map.en.md
+++ b/doc/1_KC3/1.3_Map.en.md
@@ -2,14 +2,14 @@
 
 KC3 maps are like Elixir maps, they are key-values enclosed in `%{}` :
 
-```
+```elixir
 ikc3> a = %{id: 1, title: "My title", message: "Hello, world !"}
 %{id: 1, title: "My title", message: "Hello, world !"}
 ```
 
 Destructuring works with maps to extract values :
 
-```
+```elixir
 ikc3> %{id: id, title: "My title", message: message} = ^ a
 %{id: 1, title: "My title", message: "Hello, world !"}
 ikc3> id
@@ -21,7 +21,7 @@ ikc3> message
 
 You can use the dot syntax to access map values from a `Sym` key :
 
-```
+```elixir
 ikc3> a = %{id: 1, title: "My title", message: "Hello, world !"}
 %{id: 1, title: "My title", message: "Hello, world !"}
 ikc3> a.id
@@ -32,7 +32,7 @@ ikc3> a.message
 
 You can also use the `KC3.access` function for the same result :
 
-```
+```elixir
 ikc3> a = %{id: 1, title: "My title", message: "Hello, world !"}
 %{id: 1, title: "My title", message: "Hello, world !"}
 ikc3> access(a, :id)
@@ -43,6 +43,8 @@ ikc3> access(a, :message)
 
 ---
 
+Top : [KC3 documentation](/doc/)
+
 Previous : [1.2 Integer](1.2_Integer)
 
 Next : [1.4 Ratio](1.4_Ratio)
diff --git a/doc/1_KC3/1.4_Ratio.en.md b/doc/1_KC3/1.4_Ratio.en.md
index c8486fd..d24db32 100644
--- a/doc/1_KC3/1.4_Ratio.en.md
+++ b/doc/1_KC3/1.4_Ratio.en.md
@@ -5,7 +5,7 @@ which can be any number, and the denominator which has to be positive.
 They represent fractions of integral numbers.
 They are written with a slash and no space.
 
-```
+```elixir
 ikc3> 1/2 + 2/3
 7/6
 ikc3> 1/2 * 2/3
@@ -18,6 +18,8 @@ ikc3> 1/2 - 2/3
 
 ---
 
+Top : [KC3 documentation](/doc/)
+
 Previous : [1.3 Map](1.3_Map)
 
 Next : [1.5 List](1.5_List)
diff --git a/doc/1_KC3/1.5_List.en.md b/doc/1_KC3/1.5_List.en.md
index 8fc46bd..c5ad99a 100644
--- a/doc/1_KC3/1.5_List.en.md
+++ b/doc/1_KC3/1.5_List.en.md
@@ -21,16 +21,18 @@ All these list formats are supported in pattern matching.
 
 ## 1.5.1 Functions
 
-```
+```elixir
 List List.map (List, Fn)
 ```
 
-```
+```elixir
 List List.reverse (List)
 ```
 
 ---
 
+Top : [KC3 documentation](/doc/)
+
 Previous : [1.4 Ratio](1.4_Ratio)
 
 Next : [1.6 Variable](1.6_Variable)
diff --git a/doc/1_KC3/1.6_Variable.en.md b/doc/1_KC3/1.6_Variable.en.md
index b9360c5..e33520f 100644
--- a/doc/1_KC3/1.6_Variable.en.md
+++ b/doc/1_KC3/1.6_Variable.en.md
@@ -29,7 +29,7 @@ You can also use the assignment operator which is `<-` which in turn calls
 `tag_init_copy`. It works like the C assignment operator (`=`).
 
 Examples :
-```
+```elixir
 # Declare a unsigned byte 8 bits variable "x".
 x = (U8) ?
 # Set the variable "x" to zero.
@@ -51,6 +51,8 @@ read-only again so you can use it without locking.
 
 ---
 
+Top : [KC3 documentation](/doc/)
+
 Previous : [1.5 List](1.5_List)
 
 Next : [2 HTTPd](/doc/2_HTTPd)
diff --git a/doc/2_HTTPd/index.en.md b/doc/2_HTTPd/index.en.md
index 3edfe5b..7959cb8 100644
--- a/doc/2_HTTPd/index.en.md
+++ b/doc/2_HTTPd/index.en.md
@@ -53,3 +53,11 @@ The main layout for the application is stated in
 `./app/templates/layout.html.ekc3` and `./app/templates/nav.html.ekc3`.
 Notice the `.html.ekc3` extension, these are HTML files with embedded KC3.
 See the [EKC3](/doc/EKC3) documentation for more information on these files.
+
+---
+
+Top : [KC3 Documentation](/doc/)
+
+Previous : [1 KC3](/doc/1_KC3/)
+
+Next : [3 Guides](/doc/3_Guides/)
diff --git a/doc/3_Guides/3.4_Structure.en.md b/doc/3_Guides/3.4_Structure.en.md
index 0df08ea..d1cd93d 100644
--- a/doc/3_Guides/3.4_Structure.en.md
+++ b/doc/3_Guides/3.4_Structure.en.md
@@ -42,10 +42,14 @@ Interactive shell. Terminal I/O provided by
 [linenoise](https://github.com/antirez/linenoise/tree/1.0).
 
 Example :
-```
+
+```sh
 $ make test
 $ ikc3/ikc3
-ikc3> ikc3> 1 + 1
+```
+
+```elixir
+ikc3> 1 + 1
 2
 ikc3> 2 + 2
 4
@@ -80,7 +84,7 @@ The `List.map` and `List.reverse` functions are defined in
 For example, without closing ikc3 let's redefine `List.reverse`,
 open an editor and change the line in `lib/kc3/0.1/list.kc3` from
 
-```
+```elixir
   def reverse = fn {
     (x) { reverse(x, ()) }
     ([], acc) { acc }
@@ -90,7 +94,7 @@ open an editor and change the line in `lib/kc3/0.1/list.kc3` from
 
 to
 
-```
+```elixir
   def reverse = fn {
     (x) { reverse(x, ()) }
     ([], acc) { [:reversed | acc] }
@@ -101,7 +105,7 @@ to
 
 and check the results of the last command (up key) in ikc3/ikc3 :
 
-```
+```elixir
 ikc3> List.reverse(List.map([1, 2, 3, 4], double))
 [:reversed, 8, 6, 4, 2]
 ```
diff --git a/doc/3_Guides/3.5_Tutorial.en.md b/doc/3_Guides/3.5_Tutorial.en.md
index a7a2c35..3e4add9 100644
--- a/doc/3_Guides/3.5_Tutorial.en.md
+++ b/doc/3_Guides/3.5_Tutorial.en.md
@@ -9,7 +9,7 @@ KC3 maps are key-value stores, you can use any tag as a key and
 associate a value to it.
 
 You can use destructuring to access KC3 maps :
-```
+```elixir
 ikc3> a = %{id: 1, title: "My title", message: "Hello, world !"}
 %{id: 1, title: "My title", message: "Hello, world !"}
 ikc3> a = %{}
@@ -23,7 +23,7 @@ ikc3> message
 ```
 
 You can use the dot syntax to access map values from a `Sym` key :
-```
+```elixir
 ikc3> a = %{id: 1, title: "My title", message: "Hello, world !"}
 %{id: 1, title: "My title", message: "Hello, world !"}
 ikc3> a.id
@@ -33,7 +33,7 @@ ikc3> a.message
 ```
 
 You can also use the `KC3.access` function for the same result :
-```
+```elixir
 ikc3> a = %{id: 1, title: "My title", message: "Hello, world !"}
 %{id: 1, title: "My title", message: "Hello, world !"}
 ikc3> access(a, :id)
@@ -48,7 +48,7 @@ ikc3> access(a, :message)
 `ikc3` fully supports Unicode :
 
 Some unicode characters :
-```
+```elixir
 ikc3> '\U+1B2FB'
 '𛋻'
 ikc3> '𐅀'
@@ -60,7 +60,7 @@ ikc3>
 
 ## Large integers
 
-```
+```elixir
 ikc3> a = 1 + 100000000000000000000000000000000
 100000000000000000000000000000001
 ikc3> a * a
@@ -75,7 +75,7 @@ which can be any number, and the denominator which has to be positive.
 They represent fractions of integral numbers.
 They are written with a slash and no space.
 
-```
+```elixir
 ikc3> 1/2 + 2/3
 7/6
 ikc3> 1/2 * 2/3
@@ -94,7 +94,7 @@ numbers (unsigned, signed, float, ratios, and even other complex
 numbers). For instance, you can write `a +i b` where `a` and `b` are
 real numbers.
 
-```
+```elixir
 ikc3> 1 +i 2
 1 +i 2
 ikc3> 1 +i 2 + 2 +i 3
@@ -146,7 +146,7 @@ which is called _destructuring_.
 
 
 Examples :
-```
+```elixir
 ikc3> a = 1
 1
 ikc3> a = 2
@@ -172,7 +172,7 @@ really helpful when writing large programs that need to scale in the way
 of abstractions. Let the data flow in the code through visual types.
 
 Examples :
-```
+```elixir
 ikc3> [x, y | z] = List.reverse([1, 2, 3, 4])
 [4, 3, 2, 1]
 ikc3> x
@@ -206,7 +206,7 @@ free operations with `unwind-protect`, graph database operations like
 ## If, then, else.
 
 Conditionals in KC3 are like in Ruby, for example :
-```
+```elixir
 ikc3> if true && true
 ikc3>   1 + 1
 ikc3>   2 + 2
@@ -229,7 +229,7 @@ block gets evaluated. If the condition is false and an `else` block is
 not provided, then `void` gets returned.
 
 One liner examples with `then` :
-```
+```elixir
 ikc3> if 42 then 100 else 101 end
 100
 ikc3> if 0 then 100 else 101 end
@@ -239,7 +239,7 @@ ikc3> if 0 then 100 else 101 end
 ## defmodule and def
 
 Example :
-```
+```elixir
 ikc3> defmodule Example do
 ikc3>   def three = 3
 ikc3>   def double = fn (x) do x * 2 end
@@ -268,7 +268,7 @@ containing facts : triples of subject, predicate, object.
 Examples for querying the KC3 database containing all definitions of
 the interpreter :
 
-```
+```elixir
 ikc3> Facts.with_tags(Facts.env_facts(), KC3, :operator, ?,
         fn (fact) { puts(fact.object); :ok })
 operator_eq
diff --git a/doc/index.en.md b/doc/index.en.md
index ecb9364..d4a8616 100644
--- a/doc/index.en.md
+++ b/doc/index.en.md
@@ -5,6 +5,8 @@ The KC3 programming language documentation.
 
 ## Index
 
-[KC3](1_KC3/) core language.
+[1 KC3](1_KC3/) core language.
 
-[HTTPd](2_HTTPd/) web server.
+[2 HTTPd](2_HTTPd/) web server.
+
+[3 Guides](3_Guides/) about KC3.