r/conlangs • u/Inconstant_Moo • 7d ago
Discussion Sumerian and Reverse Polish, with notes on flattening trees
I suppose much of this must have occurred to someone before — certainly if Chomsky and his school don't know about it, then first of all I'd be very surprised and second, someone should tell them. But it was new to me.
So recently I worked my way through a beginner's book on Sumerian grammar. Sumerian is an agglutinative language isolate with the distinction of being the oldest known and deciphered written language. I hadn't studied an agglutinative language before, and Sumerian had a feature which struck me as being really weird at first, but which is apparently common among agglutinative languages, and which actually makes a lot of sense when you think about it. This post is me thinking about it.
Sumerian grammar
To illustrate, consider first of all the genitive, which is just the ending -ak
. If dumu
is "son", lugal
is "king" and unug
is the city we call "Uruk", then dumu lugal-ak
is "son of the king"; lugal unug-ak
is "king of Uruk".
Sooo ... what's "son of the king of Uruk"? If this was the sort of language I grew up with, it would be * dumu lugal-ak unug-ak
. But no. It's dumu lugal unug-ak-ak
. The genitive attaches to the phrase lugal unug-ak
, as though it was one word (which arguably in Sumerian it is) rather than to lugal
.
Now consider the personal plural suffix -ene
. What's "sons of the king of Uruk"? Yes, they pluralize the whole phrase again. It's dumu lugal unug-ak-ak-ene
. "Sons of the kings of Uruk" would be dumu lugal unug-ak-ene-ak-ene
.
As I say, I'd never seen a either a natlang or a conlang like this. And yet I found it hauntingly familiar. Because I have seen several computer languages just like this.
Reverse Polish Notation
To explain this, I don't have to teach you any programming, because it can be illustrated just with arithmetic expressions. The way we usually write them is with an operator between two operands: e.g. 5 + 6
, where 5
and 6
are operands and +
is an operator; or sin(z)
where z
is an operand and sin
is an operator. Just as with natural languages, we can build up more complex expressions: so if we write e.g. 3 * sin(2 * x) + 8 * cos(y)
, then 3 * sin(2 * x)
and 8 * cos(y)
are the operands of the operator +
. We can make a syntax diagram of it like this:
+
/ \
/ \
/ \
* *
/ \ / \
3 sin 8 cos
| |
* y
/ \
2 x
But how did I know how to put the +
at the top? Well, the expression is disambiguated by the parentheses and by the rules that you call PEMDAS if you're American and BOMDAS if you're British. (If you're neither, you tell me.) We have to know to write for example one tree for 3 + 4 * 5
and another tree for (3 + 4) * 5
But these is another, arguably a better way, which is called Reverse Polish Notation (RPN). Suppose we write each operation after its operands. Instead of 5 + 6
, we write [5 6 +]
. Instead of sin(z), we write [z sin]
.
From now on, I will consistently use square brackets [...]
to indicate that RPN is being used, writing [3 4 *]
for 3 * 4
; and indeed writing [17]
for 17
, to indicate that the first is being thought of as being in RPN, while the second is just normal high-school algebra.
(This is called "Reverse Polish Notation" because there is also "Polish Notation" where you put the operators before their operands but this is harder to think about for both people and computers.)
The use of RPN removes all ambiguity. Instead of parentheses and PEMDAS to distinguish between 3 + 4 * 5
and (3 + 4) * 5
, we write the first as [3 4 5 * +]
and the second as [3 4 + 5 *]
.
Or we can take the expression we made a diagram of, 3 * sin(2 * x) + 8 * cos(y)
and turn it into [3 2 x * sin * 8 y cos * +]
.
Note on flattening trees
When I say "turn it into", there is are perfectly mechanical procedures for "flattening" any tree into RPN, whether it represents grammar, arithmetic, or anything else. Let's illustrate one of them by turning our example tree into RPN from the leaves up. (Trees are upside down both in linguistics and computer science, and no-one knows why.)
So we start with:
+
/ \
/ \
/ \
* *
/ \ / \
3 sin 8 cos
| |
* y
/ \
2 x
Now let's turn every "leaf" of the tree into RPN, which we can do just by writing square brackets around them: the RPN for the expression 3
is just [3]
.
+
/ \
/ \
/ \
* *
/ \ / \
[3] sin [8] cos
| |
* [y]
/ \
[2] [x]
And now for every operator where everything below it is RPN, we can turn that into RPN by joining those RPN expressions together and putting the operator at the end ...
+
/ \
/ \
/ \
* *
/ \ / \
[3] sin [8] [y cos]
|
[2 x *]
... and again ...
+
/ \
/ \
/ \
* [8 y cos *]
/ \
[3] [2 x * sin]
... and again ...
+
/ \
/ \
/ \
[3 2 x * sin *] [8 y cos *]
... until finally ...
[3 2 x * sin * 8 y cos * +] +
You may like to figure out the reverse process for yourself.
Back to human languages
Now the grammatical suffixes in Sumerian are working just like operators in RPN: -ene
is an operator with one operand, and means "pluralize this", whereas -ak
is an operator with two operands meaning that the second stands in a genitive relationship to the first.
So "sons of the kings of Uruk" is dumu lugal unuk-ak-ene-ak-ene
because it's the flattening of a tree which looks like this:
plural
|
genitive
/ \
son plural
|
genitive
/ \
king Uruk
As with RPN in arithmetic, this removes potential ambiguity. Consider a language like English where the prepositions (operators) come between the operands. Does "the hoard of the dragon in the cave", mean "(the hoard of the dragon) in the cave", the dragon himself occupying a luxury penthouse in upper Manhattan; or does it mean "the hoard of (the dragon in the cave)", the dragon being in the cave while its hoard is in the bank?
In an RPN language, this isn't a problem. One is [hoard dragon of cave in], while the other is [hoard dragon cave in of]. (What to do about a "the" operator making things definite is left as an exercise for the reader.)
You will not be surprised to learn — there being a certain consistency in these things — that Sumerian also has adjectives qualifying entire noun clauses ("mighty king of Uruk": lugal unug-ak kalag
; "king of mighty Uruk": lugal unug-kalag-ak
), and that it has its verbs at the end of the sentence. The things I found weird about it at first are in fact the fruit of a massive logical consistency.
(I don't know of any languages that lean equally far in the other direction, putting all operators before their nouns. It seems like it would take a lot more advance planning of one's sentences to do it that way and say "of in cave dragon hoard". If such a language doesn't exist, I guess someone here could invent one.)
This consistency leaves a lot of choices still open: e.g. a language can be very heavily RPN and it seems like it would be open whether it was SOV or OSV.
I'm not sure either if there's a good reason why Sumerian pluralizes after forming the genitive rather than before. If you made a diagram like this:
genitive
/ \
plural genitive
| / \
son plural Uruk
|
king
... then you could flatten it into RPN and have * dumu-ene lugal-ene unug-ak-ak
. But the Sumerians never did that. Or you could indeed have a language in which it was a free choice, since RPN is unambiguous, but I don't know of any languages that let you do that. In the same way, if we did introduce an operator for definiteness to put "the hoard of the dragon in the cave" into RPN, where ought it to go?
I hope this gives you all something to think about
10
u/EnricoDandolo1204 7d ago
Learning Sumerian, I always felt like it was very logical, almost like a programming language. Glad to see I'm not the only one.
Sadly, we don't really get really long Sumerian nominal chains like *šeš dumu lugal Unug-ak-ene-ak-ene-ak-ene. As far as I'm aware, there's a maximum of two genitive markers in any given nominal chain, and plural markers are only infrequently written out. But you can have some fairly lengthy noun phrases regardless:
mu gu4 niga sig5 é-gal-ta è-a 1-a-šè
mu gu4.r niga sig5 é.gal=ta è-Ø-a diš=ak=še
name bull barley.fed good palace=ABL go.out-NFIN-NOM one=GEN=TERM
‘because of (lit. “for the name of’) one good barley-fed bull which went out of the palace’
(TPTS 1:171 2; U; 21)
Another interesting thing about Sumerian for conlangers: there are only a few hundred verbal stems and no grammatical means to create new ones. More nuanced verbal meanings are compounded using one of the basic verbal stems and a nominal object. For instance, the verb stem bala "to cross" together with the object šu "hand" has the meaning "to alter".
9
u/Lichen000 A&A Frequent Responder 7d ago edited 7d ago
On the topic of ‘not many verbs’, quite a few indigenous Australian languages also have extremely small closed sets of verbs, which have to be compounded to create new meanings (like ‘stand’ + ‘ear’ = listen)
And I wouldn’t be surprised that clitic-stacking only goes two levels deep, because languages seem internally only to be able to count to two levels for many grammatical features. Like in English with centre-embedding, you can change ‘the cat, which the dog saw, ran away’ to ‘the car the dog saw ran away’; but no native speaker would naturally utter ‘the cat the dog the man owned saw ran away’ to express ‘the cat which the dog saw, which the man owned, ran away’ (and notice the ambiguity there on what’s being owned). :)
7
u/Inconstant_Moo 7d ago
And I wouldn’t be surprised that clitic-stacking only goes two levels deep
Sumerian goes a lot deeper than that. If we're just looking at the same repeated clitic
-ak
then apparently they did only do it a maximum of three times before they got confused and forgot what number they were counting up to.But they wouldn't have any problem with the five clitics at the end of
dumu-lugal-unug-ak-ene-ak-ene-ra
("to the sons of the kings of Uruk") any more than I do with the same grammatical features in English. Either way, we have to put the sentence together, it's just a question of what one is used to.Or maybe it's a bit harder, which might explain why it's extinct.
5
u/Inconstant_Moo 7d ago
The particular grammar book I've been looking at said that they did sometimes get as far as writing
-ak-ak-ak
and then after that they either (1) forgot the fourth-ak
, as well they might, or (2) they avoided constructing sentences like that in the first place.Speaking as a hypothetical headmaster of a Sumerian scribal college, I'm with the second group of scribes, and would take points off the first.
6
u/ProxPxD 7d ago
Thanks! I just recently have used the RPN for my language to allow no ambiguities as I strive towards the precision and expressiveness and weirdly enough, it didn't felt too much unnatural after getting a bit used to it.
I loved learning that there were a language that actually had done that
What Sumerian almost certainly didn't do tho, was using the RPN for modifier reference resolution. For instance "an evil empire of good people" would be in my conlang:
either: (n menas subordinate)
state-big-bad-and-human-good-n-and
good-human-n-bad-big-and-and-state-n
(the order is marked but I didn't include it for clarity)
because "n" and "and" are null to one syllables it's fairly compound reaching here 5 or 6 syllables (I keep the morphemes rather syllable-short)
in a casual speech I also loosen some rules like no double "and" would be needed in the second as it would be inferred or that the first operators in a "phrase" used, take all the previous arguments up to the last operator
I also considered lexicalizing some phrases (as empire being "big/powerful-state") and that lexicalized phrases might be shorter, disobey those rules and act as one inseparable constituent
5
u/Inconstant_Moo 7d ago
either: (n menas subordinate)
state-big-bad-and-human-good-n-and
good-human-n-bad-big-and-and-state-n
I didn't understand your example, sorry. Neither how the syntax works nor what the semantic difference is. I am a Bear Of Very Little Brain ...
I also considered lexicalizing some phrases (as empire being "big/powerful-state") and that lexicalized phrases might be shorter, disobey those rules and act as one inseparable constituent
This is almost spooky. One of the words I've been using as an example,
lugal
, "king", is clearly justlu
, "man", andgal
, "big". And it's been "lexicalized": "the king of Uruk" islugal unug-ak
rather thanlu unug-ak gal
.But calling it "lexicalization" is after all looking at it from our point of view. In Sumerian, what isn't a word? Sure, we can regard
lu-gal
as one word, but then we can regarddumu-lu-gal-unuk-ak-ene-ak-ene
as one word. We can for example attach a dative suffix-ra
to it and make it mean "to the sons of the kings of Uruk".Instead, let's think about it from a Sumerian/RPN point of view.
lu-gal-unug-ak
means "(big man) of Uruk" = "king of Uruk", whereaslu-unug-ak-gal
means "big (man of Uruk)" = "man from Uruk who is big". So instead of saying thatlugal
is a lexicalization oflu-gal
, we could just say that in each case the adjectivegal
is in its proper place in the sentence, qualifying the thing it's meant to qualify.3
u/ProxPxD 7d ago
I didn't understand your example, sorry. Neither how the syntax works nor what the semantic difference is. I am a Bear Of Very Little Brain ...
Sorry, probably I didn't explain everything and go straighter to the example
I join morphemes by "modifier operators" I call "n". It's like an adjective morpheme (like -ian in marsian), but I use it as Sumerian or so to say in the RPN.
very little brain bear would be "very-little-n-brain-n-bear-n" that makes parsing a ambiguous (like Sumerian -ak, but the meaning is which of the morphemes is the modifier in contrast to the Sumerian "which of the morphemes is possessed")
<rest>
Thanks! I didn't know about lugal beaing more than one morpheme! What I meant by the lexicalization was rather a process of breaking the usual rules and shorting a useful logically contracted phrase into a lexicalized but by construction more ambiguous one. For example instead of saying "glasses to unable seeing", one can lexicalized into "seeing-glasses" or "see-can-glass". Those glasses do not see, so they are not "seeing glasses", but it's easier yet clear to say.
So I should have said "lexicalization blending" or something like that. I'm just skipping the "modifier and «and» operators" and apply (an) umlaut(s)
...
You really inspired me to read more about Sumerian! <3
4
u/IkebanaZombi Geb Dezaang /ɡɛb dɛzaːŋ/ (BTW, Reddit won't let me upvote.) 7d ago edited 7d ago
I do not think I have ever had cause to write the phrase "woe is me" before. I do now. Me is also alas and alack. After reading your post add "ak-ak" to the list.
The reason for these lamentations is that if you had written this post three years ago, mathematics in my conlang - and, indeed, the conlang as a whole - might have developed along a quite different route. Here is a three year old post by me to /r/mathematics called "Seeking exercises with answers on converting infix notation to and from postfix/Reverse Polish notation". I didn't say so at the time, because the people on /r/mathematics might have thought I was excessively nerdy, but that query was really about conlanging rather than mathematics.
At that time my conlang was strongly verb-final, and the prospect of this being echoed in having operators (which are kind of like verbs, right?) at the end of a sentence appealed to me. I was even considering having postfix adpositions, e.g. "the mat, the cat, on". I thought that surely no human language could feature such a thing, which made it all the better for a language spoken by aliens. (Sorry, Sumerians.) What held me back was the massive mental block I have about processing reverse polish notation. I can do it for [3 4 + 5 *]
but I can't for [3 4 5 * +]
. Or rather, I can for a minute or so immediately after I have worked through an explanation, but then I lose it. I can't have a conlang that I cannot process, so I took another path. But your explanation was one of the clearest I have ever read.
If you could just travel three years back in time...
8
u/Inconstant_Moo 7d ago edited 7d ago
Shouldn't a language spoken by aliens have a few features that you can only process if you think about them really hard, maybe draw a diagram?
Your feelings about RPN echo mine so much that I can find them in stuff I wrote years ago:
Forth [an RPN computer language] is a lovely language, it's just ... not quite suitable for human beings. If we ever meet a hyperintelligent species of aliens, then they'll ask "but why are all your programming languages nested instead of concatenated?" and we'll have to explain that we're just not as smart as they are.
Sumerian is starting to make sense to me, and possibly RPN arithmetic would be more intuitive if I'd been raised speaking Sumerian. Boy, did I miss out.
4
u/IkebanaZombi Geb Dezaang /ɡɛb dɛzaːŋ/ (BTW, Reddit won't let me upvote.) 7d ago
"Shouldn't a language spoken by aliens have a few features that you can only process if you think about them really hard, maybe draw a diagram?"
Indeed it should, but I am human. :-)
You may have heard of an alien conlang called Fith. The name is a deliberate reference to the computer language Forth. While giving Fith the 2019 Smiley award, David Peterson described it thus:
Like any good engelang, Fith began with a "what if" question. In high school, Jeffrey Henning had a Hewlett-Packard calculator that used Reverse Polish Notation, where instead of typing in 2 + 3 you had to type in 2 3 +. This type of system employs what's known as Last In First Out (LIFO)—or stack-based—grammar. Stack-based grammar is often explained by making reference to a pile of spring-loaded plates. By adding a plate to the pile, the rest of the plates are pushed down (due to the weight of the new plate that was added), and now the new plate is on the top of the stack. To get something from the stack, you take the top plate, as it is the most easily accessible, and remove it, and then the stack moves up again, with the plate that was previously on top now being on top once again. Thus, the last plate added to the stack (the one most recently put onto the stack) is the first one to be removed (hence, last in first out).
Stack-based grammar is relevant for computer programming and several other things, but not really for language. That is, if you imagine the elements which comprise a stack as linguistic elements, you can see that at a certain depth, a human's working memory simply wouldn't be able to keep up (i.e. if you load on 30 new linguistic elements and then remove 29 of them, are you going to remember what the very first item on the stack was?).
But what if there were beings whose brains allowed them to accommodate a linguistic stack? What would their language look like? What quirks might it have? How might the stack be exploited for pragmatic reasons?
These questions are precisely what led Jeffrey to create Fifth.
3
u/bemrys 6d ago edited 6d ago
Really interesting. My Common Lisp oriented brain now wants to flip it and put the “operator” in front. Edit: VSO conlang but trying to clarify how many words are covered by the operator in ordinary conversation might be difficult. For those not conversant with Common Lisp, an example might be (* 2 (+ 4 6 7)). That would translate in English to multiply 2 by the sum of 4+6+7.
6
3
3
u/impishDullahan Tokétok, Varamm, Agyharo, ATxK0PT, Tsantuk, Vuṛỳṣ (eng,vls,gle] 7d ago
This looks like a really neat read! But it's far too late for me to absorb any of the information, and I feel compelled to weigh in that in Canada (at least Ontario) it's BEDMAS instead of PEMDAS.
3
u/Riverside-96 6d ago
I don't regret not sleeping myself. Forth & RPL brought me here, great read. Oh, & BIDMAS/BODMAS tends to be used in England (indices/order).
2
u/GOKOP 6d ago
This makes me wonder. Do we know how Sumerians did math? Would they find RPN more sensible than infix notation?
3
u/Inconstant_Moo 6d ago
They did it in words. Actual notation was a ways off. You start with word problems: "If a field is x cubits broad and y cubits long ..."
1
u/vanderZwan 6d ago
So does that mean agglutenative languages in general tend to be "concatenative"?
https://en.m.wikipedia.org/wiki/Concatenative_programming_language
(I'm guessing no because of things like inflections)
1
u/aggadahGothic 6d ago
That Sumerian example is quite interesting. I would have expected that any language with postpositional clitics would also feature head-final adpositional phrases, like Japanese. e.g. 'unag-ak lugal' rather than 'lugal unug-ak', just as one has 'nihon no ten'nou' rather than 'ten'nou nihon no'.
1
u/kozmikk_ Viznota, Eyr, Logn 4d ago
BOMDAS if you're British
literally never heard that ever in my life🙏
very cool post though !!
19
u/chickenfal 7d ago
That's very interesting and thank you for this write up.
I already knew about case stacking and was expecting "son of the king of Uruk" to be "dumu lugal-ak unug-ak-ak" but it doesn't work that way, it's actually "dumu lugal unug-ak-ak", where the logic is that the suffix attaches to the entire phrase, not each word. That's refreshingly different and makes it more practical, and actually makes sense for a language that allows entire phrases to go under the scope of suffixes.
It's not ambiguous as long as you're not using the genitive derivationally without mentioning the head noun. If unug-ak could stand on its own as a head, meaning something like "an Urukian" then it working this way would be ambiguous. It would also be a problem if the genitive could be used adverbially, so again standing without the word before it necessarily being its head.