German as RPN

Date:January 25, 2004 / year-entry #32
Tags:non-computer
Orig Link:https://blogs.msdn.microsoft.com/oldnewthing/20040125-00/?p=40913
Comments:    23
Summary:It should be noted that "Reverse Polish Notation" is named in honor of the Polish logician Jan Lukasiewicz, who developed prefix notation, wherein the operator comes before the operands. Postfix notation proved more useful for stack-based arithmetic computations, and so the opposite of prefix notation came to be known as "Reverse Polish Notation". It was...

It should be noted that "Reverse Polish Notation" is named in honor of the Polish logician Jan Lukasiewicz, who developed prefix notation, wherein the operator comes before the operands. Postfix notation proved more useful for stack-based arithmetic computations, and so the opposite of prefix notation came to be known as "Reverse Polish Notation".

It was kind of a strange feeling when I encountered Polish notation in logic class. Finally I got to see the forwards version of what I had been doing in reverse for so many years!

Anyway, here's a classic example of German as RPN, hidden in a web page on the subject of Dutch word order. Consider the clause "... that Frank saw Julia help Fred swim." In German, that would be expressed as

... daß Frank Julia Fred schwimmen helfen sah.
... that Frank Julia Fred swim help saw.

You can create this sort of constructing in English too, but nobody does this unless they are trying to cause trouble: "The rat the cat the dog chased caught died."

English also gets somewhat unpredictable if you decide to start the sentence with something other than the subject:

What you need I cannot give you. Object first, no inversion.
Nothing but blue skies do I see. Object first with inversion.
Sometimes it snows. Adverb first, no inversion.
Rarely does it snow. Adverb first with inversion.

It's like English is struggling to decide whether it wants to hang out with its Germanic buddies and use X-V-S or strike out on its own and be an S-V language.

I found German an easy language to learn because it is much more logical, much less capricious. "The verb goes in second position, the adjective goes in front of the noun."

"But what if the adjective is really long?"

"Tough. Goes in front. Because that's where adjectives go."

Swedish (at least to my unaccustomed ears) leans more towards the capricious end of the scale. What's the difference between "från" and "ifrån" and "i från"? It's probably one of those subtleties that I will never learn.

Okay, enough about language. Geek talk resumes on Monday.


Comments (23)
  1. mike says:

    BTW, in linguistic terms, what you identify as RPN is referred to as SOV — subject, object, verb. There are languages representing all combinations of this threesome. English is fundamentally an SVO language. (Japanese is SOV.) To account for differences from this pattern in actual utterances, TG (tranformational generative) grammar posits an underlying structure that represents the pattern, and transformations that change it under various circumstances. For example, a German sentence is SVO, but in independent clauses, a transformation is applied that puts the verb into second position.

    Also and FWIW, there isn’t much in language that’s "capricious." Take so-called irregular verbs (in Germanic philology, "strong" verbs). Although the ablaut in strong verbs looks capricious — this would be true for English, German, and every other Germanic language — the pattern of ablaut follows phonological rules that applied at the time the verbal system was developing. As a simple example, we have sing-sang-sung (singen-sang-gesungen); if we were to invent a new verb "ling," it would either be "weak" (he linged) or it would follow the pattern of sing (you lang?). IOW, the rules within languages ARE constrained, and however capricious one thinks English word order is, there are all sorts of rules. You cannot say:

    Snow it does rarely.

    And word order does matter; capricious it might seem, but it does matter. Same words, different order, different meanings:

    What you need I cannot give you.

    You need what I cannot give you.

  2. SBC says:

    yikes.. I use to love programming my HP calculators.. miss it somewhat..:-)

  3. Miles Archer says:

    Yoda english strangely speaks. German language must be native. Wonder, I, what Yoda sounds like in German.

  4. The Swedish School network got a nice word dictionary – http://lexin.nada.kth.se/sve-eng.shtml

    Från is a hard word since it can be a

    1. start in time or space

    åka från Stockholm – go from Stockholm

    2. origin, extraction, birth

    en vas från 1500-talet – a vase from the 16th century

    3. distinguish

    skilja sig från mängden – stand out from the rest, stand out in a crowd

    ifrån is the adverb

    jag är långt ifrån nöjd – I am far from pleased

    I guess there are plenty more of misstakes to be made with Swedish words since most are all in how your pronounce them :)

  5. Dan Crevier says:

    Japanese is like reverse polish notation too. I always thought that was really cool. It even has "particles" that are kind of like pressing the "enter" button on RPN calculators.

  6. Perry Lorier says:

    … wherein the operator comes before the operands …

    Isn’t that … wherein the operator comes *after* the operands … ?

  7. Raymond Chen says:

    In prefix notation (Polish notation), the operator comes before the operands. For example, "* 2 + 3 5" is "2 * (3 + 5)". Lispers should find this all very familiar.

    In postfix notation (reverse Polish notation) it comes after: "2 3 5 + *".

    Both prefix and postfix notation are unambiguous. Infix notation on the other hand requires precedence rules/parentheses to resolve ambiguity. "(2 * 3) + 5" vs "2 * (3 + 5)".

  8. jdzions says:

    When they translated Yoda into German, they put the words in the order in which they would appear in an English sentence. Of course.

    Old joke. Two people in Berlin attend a very modern, almost experimental play. After 15 minutes, one says to the other (in German, of course) "I’m bored; nothing’s happening. Let’s leave." The other says "Wait another minute or two and I’m sure they’ll get to the verb."

  9. Moi says:

    German is even worse than you paint it. After all, one can in some cases split the verb and send the first part of it to the end of the sentence. For example to change trains is "umsteigen" but depending on the sentence the "um" could come in another half an hour when the sentence finishes, so you don’t know if the person is changing trains, getting into the train ("einsteigen"), getting off the train ("aussteigen")…

  10. Raymond Chen says:

    Mind you, this phenomenon happens in English if you let it. "I threw the ball you found yesterday in" or "I threw … away" or "I threw … around". English comes with the verbs pre-split, and the particle sometimes wanders away.

  11. Moi says:

    Yeag, but you’re not constrained by the grammar to do it that way. In fact you are generally taught that it isn’t clear and is therefore A Bad Idea :)

    Oh, and English sentences don’t tend to be as long as German ones either, for pretty much the same reason.

  12. J. Daniel Smith says:

    jdzions – can you post the joke in German? I’m thinking there is some word play going on in German that gets lost in the translation.

  13. Gernot says:

    For the non native German speakers learning the gender requirements for prepositional phrases, one is required to memorize the cases.

    for "fun" take this test:

    http://german.about.com/library/weekly/aa082498.htm

  14. Raymond Chen says:

    Why pick on German? Prepositions rarely match up in any languages once you get past the literal meaning. In Swedish, you work "on" (på) a company instead of "at" it; in French you swap "against" (contre) something instead of "for" it.

    Yes, German has four categories of prepositions. My favorite is the "mixed" category which captures a distinction often lost in English between being somewhere and going somewhere. For example, walking "in a building" can mean either "in einem Gebäude" (say in a hallway) or "in ein Gebäude" (going in the door). In English, you can use "-to" to emphasize the latter case ("into", "onto") but that doesn’t always work ("betweento"?).

    On the other hand, German has only about 30 prepositions. English has over 100.

    If German offends you then stay away from Polish (7 cases) or Finnish (15!).

  15. Gernot says:

    Just noting an area I have found challenging while learning German. I choose German because I know that second language the best. I do not know Italian well enough to have worried about memorizing all of their prepositions.

  16. Eric Lippert says:

    To myself wondering just was I, if so smart Yoda is, why not words right order in his sentences put?

    Kidding aside, both Lucas and JRR Tolkien used a clever trick to indicate the age of a character — the older a character is, the more archaic their syntax and vocabulary become.

    In LotR, for example, the hobbits use only modern inflections. The Rohirrim speak Old English amongst themselves and have somewhat archaic syntax. Elrond has _extremely_ archaic syntax. And Gandalf’s syntax moves back and forth depending on to whom he is speaking.

  17. tekai says:

    don’t be scared about the 15 cases in finnish, some of the replace prepositions, eg. the inesiivi (-ssa/-ssä) is used in when you would use "in"

    kissa on metsässä = the cat is in the woods

  18. Moi says:

    I got 70% on the "fun" test. Ouch.

    One thing I noticed is – why does number three say "Bei schlechtem Wetter werden wir uns in der Halle treffen"?

    Shouldn’t it be "Bei_m_ schlechte_n_ Wetter werden wir uns in der Halle treffen.", or have I missed something?

  19. Martin Liversage says:

    I have always found it very difficult to learn how German prepositions affects the rest of the sentence (akkusativ etc.)

    Turkish is much simpler (not that I’m an expert). As far as I know Turkish doesn’t have prepositions, but instead uses three suffixes to indicate direction: "-a" meaning "to", "-da" meaning "here" and "-dan" meaning "from".

    "(I) come from Denmark" -> "Dinamarka[dan] geliyorum"

    If I wanted to say I live in Denmark I would use the form "Dinamarka[da]", and if I was going to Denmark I would use the form "Dinamark[a]".

    Now, someone with proper knowledge of the Turkish language will probably be able to correct all my errors, but I believe that the overall idea of using only three suffixes instead of prepositions is correct.

  20. foo says:

    >Shouldn’t it be "Bei_m_ schlechte_n_ Wetter werden wir uns in der Halle treffen.", or have I missed something?

    You have missed a minor subtlety. While your suggestion is grammatically correct, but "beim" is actually short for "bei dem", and a direct article "dem" doesn’t make much sense when talking about weather in general. "Bei schlechtem Wetter" leaves the article out, causing the "m" (which indicates Dativ) to move to the adjective (therefore "schlechtem").

  21. Moi says:

    foo – Thanks!

    I think the reason I "missed a minor subtelty" (what a wonderful euphemism for "got it wrong"!are you a diplomat?) is that in English one might well say: "If the weather is bad we will [whatever]." That is, in English we /do/ use the direct article! You could also say "In the case of bad weather we will [whatever]." but it sounds unwieldy. I asked some Germans about this and… they didn’t know why… "That’s just the way it is." Ho hum.

    What’s funny is that I find the use of the definite article more common in Germany than in English – "Der Martin hat [etwas]". Maybe that’s just a regional thing, however.

    I still don’t get the "fahre mit mit" thing either.

  22. KH says:

    Martin: That’s essentially correct (barring things like vowel harmony and adding consonants if it would otherwise be unpronouncable, which only make things more confusing for a simple example).

    But Turkish has only 6 cases. ("Only", because I’ve heard Hungarian has something like 50.) Obviously there are a lot more prepositions (over, above, around, next to, behind, …). So it’s not quite as simple as "3 cases(suffixes) for prepositions". But almost.

    Even so, I think Turkish is far simpler than English, or even German. I was putting together much more complex sentences much earlier when studying Turkish than when studying German. The only thing I found harder is listening to native Turks speak (at native-speed), because it’s a fairly dense language. Extremely logical, though. Programmers should love it.

  23. Evren says:

    Hi from Turkey,

    "Danimarka(dan) geliyorum" is the answer of "Nereden?" means "where from?" -den suffix usually means "from" in English..

    Danimarka(ya) is the answer of "Nereye?"

    Look,

    Nereden geliyorsun? –Nere*den*–

    Danimarkadan. –Danimarka*dan*–

    by the way,Denmark is Danimarka in Turkish.

Comments are closed.


*DISCLAIMER: I DO NOT OWN THIS CONTENT. If you are the owner and would like it removed, please contact me. The content herein is an archived reproduction of entries from Raymond Chen's "Old New Thing" Blog (most recent link is here). It may have slight formatting modifications for consistency and to improve readability.

WHY DID I DUPLICATE THIS CONTENT HERE? Let me first say this site has never had anything to sell and has never shown ads of any kind. I have nothing monetarily to gain by duplicating content here. Because I had made my own local copy of this content throughout the years, for ease of using tools like grep, I decided to put it online after I discovered some of the original content previously and publicly available, had disappeared approximately early to mid 2019. At the same time, I present the content in an easily accessible theme-agnostic way.

The information provided by Raymond's blog is, for all practical purposes, more authoritative on Windows Development than Microsoft's own MSDN documentation and should be considered supplemental reading to that documentation. The wealth of missing details provided by this blog that Microsoft could not or did not document about Windows over the years is vital enough, many would agree an online "backup" of these details is a necessary endeavor. Specifics include:

<-- Back to Old New Thing Archive Index