porky11 / minlang
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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
Minimal Language
===
For some example story see `story.txt`. It's just a translation of an existing story.
For examples, see file `examples.md`
# Goals of the language
This language aims to have a minimalistic but yet flexible grammar. It is based on set theory and tries to use as few as needed grammatically different kinds of words.
Even the used letters should be minimal. In order to keep it simple, all brackets should be implicit.
It also should be possible to define new words of all kinds in a simple way.
The language is aimed to be a speakable language, but it would be preferable if the language can also be used as programming language.
It would be possible to replace the used letters and sounds by letters and sounds of other languages, to use tones, prefixes, postfixes for some grammatical elements, and more.
But in order to keep it simple and general, none of such things exists. A single word has a single function everytime, there are almost no unspeakable symbols to structure the sentences, except for seperating words, sentences and optinally also syllables.
# Letters
In order to be able to discriminate between vowels independent of the own language, there are only five of them:
a, e, i, o, u
There are also just a few consonants.
The following consonants can be used for the words. How they can be spoken is declared after them:
p: b p
t: d t
c: k g
s: s z
v: w
x: (spanish "j", german "ch")
z: sh (german "sch")
f: f v
n: m n
r: r l
j: i y
Letters can be grouped like this:
A = a, e, i, o, u
T = p, t, k
S = f, s, z, x
N = n
R = r, j, v
L = n, r, j, v
Words can be written as multiple syllables. They are seperated by a `-`.
This is how a syllable S can be built:
S = TFLARNFT
For each group of letters one letter can be inserted. All gropus are optional. So a syllable does not require to have a vowel in it. There cannot be double vowels, because for some it is not clear, how they are pronounced. The letters `v` and `j` are used to simulate double and triple voewls.
`v` is used to simulate `o` or `u` , and `j` to simulate `i` or `e`.
Without seperating syllables, they are interpreted so, that there are as few syllables as possible.
If something could be attached to two syllables, it will be interpreted as the beginning of the first syllable.
TFLARNFTARNFT = TFLARNF-TARNFT
TFLATFLARNFT = TFLA-TFLARNFT
# Grammar
Sentences of the described language are described by making it *this way*.
Translations are written after such a sentence with a `=>` before them.
## Sets
Everything in this language is represented by sets.
The only kinds of grammatical elements are simple sets, binary operators, relative sets and modifiers.
Preferably simple sets and binary operators should be used for talking about objects. relative sets and modifiers should only be used for things, that cannot be expressed in different ways, or are too complicated to be expressed that way.
Sets will be expressed by `'` followed by an uppercase letter.
*'A* => The set of 'As.
### Simple sets
The simplest sets are just represented by single words. In most cases, where simple sets can be used, also other sets can be used.
### Binary operators
Sets can be constructed with simple operations of the set theory.
Connection operators are the only binary operations. They are inserted between multiple sets.
They will be denoted by `-` followed by a lowercase letter.
*'A -a 'B* => The set generated by the operation -a applied to the sets 'A and 'B
The default relation, when nothing is written between the two sets, is the intersection of them.
*'A 'B* => 'As, that also are 'Bs.
### Relative sets
Relative sets are like functions of sets.
They can just select elements from a set, create a special set of objects, which relate to the elements of a set, or everything you can think of.
Relative sets will be denoted by `'` followed by a lowercase letter.
*'a 'A* => The set 'a relative to 'A.
### Modifiers
These modify the meaning of the following word. Together with the following word they can be treated as a single word. They may be used to talk about the words itself, without interpreting them as sets, or to change the meaning of relative sets.
You can also think of them as macros, that don't know about the semantics, which replace words with meanings, that may have no names.
They can be seen as prefixes.
In order to apply multiple modifiers to a word, the modifier has to accept being applied to other modifiers, which has to generate a new modifier.
Modifiers even can take any numbers of arguments using currying.
## Structure
The language tries to be simple and expressive. In order to achieve this, brackets should be possible, but implicite.
The way this language handles this is without using special symbols.
Every relative set increases the hierarchy level. Every simple set decreases the hierarchy level.
Binary operations don't change the hierachy level.
The simplest way to know these relationships for a large sentence is just putting a opening bracket after a relative set, and a closing bracket after a simple set. In the end you optionally have to add some additional brackets at the beginning and the end of the sentence until every bracket has a matching partner.
If there are some pairs of brackets at the same hierarchy level, they are right associative.
This method of relation may seem not intuitive, but in example sentences you'll see it works well for many situations.
A simpler way to think about this is, that a relative set can take an arbitrary amount of other relative sets as arguments, but just a single simple set.
This is useful in many situations.
# Words
## Important sets
### Primitive
*o* => everything, true
*l 'A* => same set as 'A (mainly important for structure)
*a 'A* => a set containing a single element of 'A
*no 'A* => complement set of 'A
### Binary set operations
*'A is 'B* => elements of 'A are elements of 'B (the resulting set contains everything except 'A without 'B) (implication)
*'A en 'B* => elements of 'A or 'B (union)
*'A or 'B* => elements are either in 'A or 'B (exclusive or, unequal)
*'A se 'B* => elements of 'A without elements of B (equal to *no l 'A is 'B)
*'A ic 'B* => sets 'A and 'B are equal (equal)
### Relative sets
*i* => I, me, we, us, the talker(s)
*u* => you, the one(s) being talked to
*ju* => me (or us) and you
*jo* => me (or us) and others
*vo* => you and others
*juo* => me (or us), you and others
### Referencing specific objects
Sets may depend on context:
*te* 'A => the last recent talked single element of 'A referenced by *a 'A*
*it* => set containing the last element refernecec by `a`; equal to *te o
*tis* => the object(s) I point at
You can also call something by names explicitely:
*… n* => modifier turns the following word into a name. it can be referenced also by using *… n*
## Tuple sets
All sets of objects can be seen as sets of tuples of objects. To get an element of a tuples, there are accessor functions, which can be described as relative sets.
### Relations
The simplest way to describe a relation between multiple objects is by using a relative set describing the relation.
But it may be useful to be able to express both directions of a relation, so there is the need of two relation, so that following is true:
*'A is 'a 'B o ic l 'B is 'b 'A*
It would also be possible to just define one of 'a or 'b, and generate the other one of them using a modifier, but then it would not be clear, which of them is the default.
They could also be generated by using different modifiers on a single word expressing the relation. but then the word itself wouldn't have a meaning.
So the best way to express a relation is as a set of objects containing information to both kinds of related objects.
These have to be accessed by relative sets.
Since most relations are binary, but the roles have no special meaning these are the accessors for the relative sets:
*ni 'A* => minor/first/smaller elements of tuples in 'A
*na 'A* => major/last/larger elements of tuples in 'A
This way, it's also possible to talk about the relation as objects themselves, and to describe even other objects participating in the relation.
*par* => a parent-child relationship
*ni par* => children
*na par* => parents
### Actions and actors
The simplest way to describe an action is as the set of actors of it.
For simple actions this is useful, but most actions have multiple actors in different roles.
*'A is 'B* => 'A is doing action 'B
If there are only two roles, it may be possible to describe this as a relative set.
*'A is 'a 'B => 'A is actor of 'a relative to 'B*
There are problems with this approach:
* only useful for binary actions
* difficult, to talk about the action itself
* the additional argument to may often be not required
* even for actions with just two roles, you may find new roles applying to it
Instead, actions should be defined as a simple set of objects themself.
There are relative sets, when used relative to actions, they extract the different roles of these actions.
These are the most important words for extracting them:
*ca 'A* => set of actors of 'A
*ci 'A* => set of objects affected by 'A
*co 'A* => set of object aimed at by 'A
So when you want to describe an action 'A more detailled, you can say this:
*a n is 'A. 'B is ca a n. 'C is ci a n. 'D is co a n.*
=> what we call a is 'A done by 'B affecting 'C aimed at 'D
Instead of writing *'B is 'b 'A* for every set 'A and every role 'b where 'B is of, it would be nicer to write something like *'a 'B*, where *'a 'X* => *'X is 'b o*
Such a action can be created by following modifier for every relative set:
*t 'a 'A* => modifier of a relative set. set of objects, where 'A is in relation 'a to it
The sentences from before can now be written in a simpler way:
*'A is t ca 'B t ci 'C t co 'D*
### Selection based on attributes
Selecting objects from a set based on attributes can often be done by unification.
But when an attribute has to have a value:
*saj 'A is ni x l t na saj 'B*
'X is element of 'A and it's size is smaller than 'B.
*'X is l 'A ni x saj t na 'B*
## Numbers
Numbers are just like other objects, but they can be defined by different modifier prefixes:
*ov …* => octal number
*pin …* => binary number
*tetzi …* => decimal number
In order to get a set of a specific size, you can use cardinal numbers, which are relative sets.
*'n 'A* => a set containing 'n elements of 'A
Numbers are generated using modifiers and a representation for numbers.
*nan …* => Extracts … elements from number.
(How should … be evaluated? Should something like this be possible:
*nan sun l ov 1 en ov 2 o o*
((nan sun(l(ov 1) en ov 2) o) o)
=> one plus two objects
This seems complicated, and is a pretty complicated extra grammar using modifiers.
This modifiers uses the whole grammar of the language.
Another solution may be preferable)
So numbers could just be interpreted as sets of size of this number:
*nan … o* => Set of … arbitrary elements
*z …* => reverse meaning of assymetric binary relations (the only of such relations is `is`
### Rank
The rank of an object is the position of an object in the referenced set.
*ran 'A* => rank of an object in set 'A, starting at zero
A rank can be specified by looking at multiple elements of the set in an unspecified order, and giving it some numbers.
Getting some elements of a set.
*'X is l 'A ni x ran t na ov 7*
=> 'X contains the first 7 elements of 'A
Following means the same thing:
*'X is l 'A. ran 'X is ni x l t na ov 7*
So the way to interpret this is, when all elements have a rank smaller than the specified value, the set contains just these elements.
(When this really works, why does the relative set *a* have to be relative? Because it additionally sets a reference marker)
### Mathematical functions on sets
*nun 'A* => Count of the elements in 'A, zero, a natural Number, or unknown (which is also used for infinite sets)
*sun 'A* => Set containing the sum of all elements in 'A
*nur 'A* => Product (mul)
*nec 'A* => Negate all values inside 'A
*inf 'A* => inverse of the elements of 'A (one devided by the element)
*n avg ic nur sun 'A inf nun 'A*
*n avg ic nur
## Attributes
One way to talk about attributes of an object is by having a relative set, which describes all parts of an object.
*pa 'A* => parts of 'A, parts 'A consists of
But in most cases, it's more useful to have different kinds of attributes, which can be accessed using different relative sets.
These are sets of objects, that are not necessarily useful by themselves.
*saj 'A => (spatial/volumetric) size of 'A
*taj 'A => age of 'A
### Comparing attributes
In order to compare attributes, it would be possible to have a relation 'A, whose both related objects have the role of something that has a higher value and something that has a lower value.
Then, in order to compare attribute 'a of 'B and 'C, you could say:
*'a 'B is ni t na 'a 'C o 'A* => the value 'a of 'B is lower than the value 'a of 'C
The way this really is done is by using modifiers. Now it is required to repeat the name of the attribute.
There is a modifier, which generates a new relation, which compares the specific value.
*x 'a* => the relation (as set) looking at value 'a
This is the way to express such a relationship:
*'B is ni t na 'C x 'a* => 'B is lower than 'C when looking at value 'a for both
It's still possible to create the previously mentioned relation 'A and apply it to the attributes itself. Therefore the watched attribute 'a has to be *l*.
### Absolute attributes
When you want to say some of the attributes has a high value, it is difficult this way.
What would it logically mean?
## Orders
*van 'A* => someone who wants 'A to be true
*i is van l u is ca go*
=> I want you to go/move by yourself
*zav 'A* => someone who should/has to be (do) 'A
*u is zav ca go*
=> you should go (be a goer)
*tu 'A* => do (be) 'A
*tu ca go*
=> (please) go!
## Quoting
Quoting is useful to talk about things, not neccessarily having a meaning, mostly for using multiple words as single words.
*"Quoted text"*
(Problem: Recursive quotes? Solution: Quotes have to touch non-whitespace letters.
Problem: Quoting Whitespace? Solution: Recursive quotes not possible.
Problem: Talking about quoted whitespace? Not possible)
## Something?
*an 'A => objects at the same place as 'A
### Talking about talking
*sej* => The action of talking/saying something.
*u is ca t co i t ci l i is ca t ci l o is ci sej o o sej o sej*
*u is ca l sej t co i t ci l i is ca l sej t ci l o is ci sej*
=> You say to me, that I say, that something is said.
Here you also can see the problems of the implicit brackets, where the words *l* and *o* sometimes act like brackets.
By restructuring it's possible to make it simpler.
### Sets with Subsets
These are used to get subsets of a set.
These are only useful with using with some default set, since they don't select objects of a set, that have a specific attribute, but describe the attribute.
The modifiers together with the words have the meaning themselves. There may not be other words for these sets.
This is done, when there are multiple subsets of a set. This way it's easier to learn all of these words. Instead of three words (the super set, both subsets) you have to learn the both subset modifiers once and the meaning of the set, and probably one of the meanings of the sets, but this should be clear anyway.
The other meaning will be known after that.
*ir 'A* => modifier, the one kind of 'A
*ar 'A* => modifier, the other kind of 'A
Here the probably most simple example, you would think of. In this case you may know both meanings without reading the specialized meanings.
*noj* => having a sex/gender
*noj ir* => female
*noj ar* => male
It is not required, that all objects of the superset are in one of both subsets, and that they are in just one of the subsets, when creating such words.
But normally that's the case.
Even in this case, there may be cases, where some object, having a gender, is as well male as female, or non of both (especially for non human races)
## Time and Space
Time and space are interpretet as the set of objects, that exist at a specific time or space.
*nav => the current time.
*ri 'A* => horizontal position of 'A (left is smaller)
*ro 'A* => vertical position of 'A (down is smaller)
*ra 'A* => positoin in look direction of 'A (behind is smaller)
*faj* = time relationship (before, after)
*et 'A* => At the time of 'A, all objects, that exist at the specified time, at the same time as 'A is true. While/During 'A.
*in 'A* => Everything in the same position as 'A.
### Relative clauses
Conditional:
*if 'A* => true if 'A is true (*o*), else it's false (*no o*)
Causal:
*pov 'A* => because of 'A
(is this really required or is it simple enough to express this with set theory directly?)
Modal not required(?)
Final:
TODO** =>
Temporal (while, before, after) done by combination of *et* and *faj*
### Questions
*vat* => Set of objects one wants to know about, used to ask questions.
*u is ca vat* => What do you do?
*vat ic l u is ca 'A* => You do 'A, right?/Do you do 'A?
Answers:
*tat* => the thing someone asked about.
*tat ic 'A* => I do 'A
*tat ic o* => That's correct/I do 'A
*tat ic no o* => That's not correct/I don't do 'A/that you do a is equal to nothing
*vat nav is ca 'A* => Who is doing 'A?
*i is tat* => I (for example) am doing a 'A
*i ic tat* => I am doing 'A
*if vat u is ca 'A* => in which case do you do 'A?
*pov vat u is ca 'A* => Why do you do 'A?
*et vat u is ca 'A* => When do you do 'A?
*tat ic nav* => Now I do 'A
*u is ca 'B o is tat* => While you do 'B (maybe even longer, since it's just a subset using *is*)
## Use foreign words
This is done by modifiers.
There is a modifier for foreign simple sets and a modifier for foreign relative sets.
The language, from which the words come from, can be every langauage, and is also allowed to contain different letters, just no whitespaces.
The exact meaning of foreign words may not be clear, especially when used as relative sets.
*lo …* => Foreign simple set
*pi …* => foreign relative set
*i is ca l lo run lo fast* => I run fast.
*i is ca pi from 'A pi to 'B go => I go/move by myself from 'A to 'B
### Referencing single letters
*xe …* => the name of the letter …
Normally the letter is a single letter of this languages.
It is also possible to use foreign symbols or using multiple signs to describe it.
If a symbol is not part of this language, it's not clear, how it sounds.
*xe cvu* => empty sign
### Time modifiers?
*'a c 'A* => for temporal actions, the opposite of it
(assuming *'a 'A ic ni faj is 'b 'A na fai is 'c 'A*, then *c 'a 'A ic na faj is 'b 'A ni fai is 'c 'A*)
*(('A) is t('a('B) o) o) ic l('B) is 'a('A)*
*'A is t 'a 'B o o ic l 'B is 'a 'A*
*ejt* => eat
*go* => moving by oneself to a place
*zu 'A* => Action of moving towards something
# Program
How a computerprogram could handle sets with undefined elements:
Sets with undefined number of elements are just names for the sets or expressions.
Sets with known elements can be represented as lists of their elements.
Complements of sets of known elements can just be defined as complements.
TODO:
* More kinds of Questions.
* Numbers.
* Talking about the language.
* Quoting expressions containing whitespace.
* Implement foreign words. These will allow to connect with lisp directly inside the language.
* Declaring new word of the language.
* Program should generate some normalform for set expressions (DNF, CNF, ?)
* Language should handle sets
* Write computer programs.
* Are modifiers too mighty and complicated? Should they be dropped? They just come handy, when no other tool of this language works, or would be too complicated. They were not intended for this design of the language. But without modifiers, there would be a need of many more words, which not even are useful in most cases, and would in some cases almost do, what modifiers do, and could just be called the same. Maybe it would even be useful to restrict the length of a word to one syllable and require other syllables to be handled as modifiers. But this would change the fundamental rules of the language, and be less minimalistic. Modifiers are like cheating and allowing every new grammar you want. And sometimes this even simplifies everything very much.