5 ms·
Kip: A programming language based on grammatical cases of Turkish
- lolc 9mo agoHaha I can read some casual Turkish and this made my day! Funny how the case system of Turkish is both strong and standardized enough for this to work well. I don't know any other language where flexible argument order would work so well.
- thaumasiotes 9mo ago> I don't know any other language where flexible argument order would work so well. What kind of sample size is that? A case system and flexible argument order are largely the same thing. Note also that flexible argument order is a robust phenomenon in English: 1. Colonel Mustard killed him in the study at 5:00 with his own knife. 2. Colonel Mustard killed him at 5:00 in the study with his own knife. 3. Colonel Mustard killed him in the study with his own knife at 5:00. 4. Colonel Mustard killed him with his own knife at 5:00 in the study. 5. Colonel Mustard killed him at 5:00 with his own knife in the study. 6. Colonel Mustard killed him with his own knife in the study at 5:00. But if you insist on looking in other languages, there's a famous Latin poem beginning Quis multa gracilis te puer in rosa perfusus liquidis urget odoribus grato, Pyrrha, sub antro? Translating this as closely as possible to a one-word-for-one-word standard, it says What slender boy soaked [in] liquid odors presses you among many rose[s], Pyrrha, beneath [a] pleasant cave? (Notes: rosa is singular for unclear reasons. There is nothing corresponding to the in of "in liquid odors"; the relationship between the odors and the soaking is expressed purely by case. There is also nothing corresponding to the article in "a pleasant cave"; Latin does not mark definiteness in this way. Location inside a cave is expressed with "beneath"; compare English underwater.) Anyway, the actual word ordering, using this translation, is: What many slender you boy among rose[s] soaked liquid presses [in-]odors pleasant, Pyrrha, beneath [a-]cave? I've heard that Russian poetry is given to similarly intricate word orderings.
- lolc 9mo agoYeah sure there are other languages where the cases allow flexible argument ordering. I should have written "another language" not "any other language" because I meant the languages I know. I can see how it'd work in Latin. Though poetry takes a lot of license with language, so by quoting from poetry, we're at the extreme end of what a language can do. From what little I remember in Latin there would be examples where one couldn't distinguish the cases. The only variation in your English examples is with the prepositions. English is a language where you just do not get that kind of flexibility. Unless, again, you do poetry. Can't even put the inflected pronoun first even though it would be unambiguous: Him Colonel Mustard killed. Let's look at this contrived example: The policeman bites the dog. Notice how in English I can't reverse them easily. Have to get creative: The dog the policeman bites. Stilted and prone to get misunderstood isn't it? In German, this is possible: Den Hund beisst der Polizist. Though if you do that, people think you made a mistake and will misunderstand you. The cases are rather weak in German. No comparison to Turkish: Köpeği ısırıyor polis. They do it for emphasis as part of everyday speech. You can put the subject first or last or in the middle and there is no confusion. Though admittedly that example is stretching it :-)
- thaumasiotes 9mo ago> Can't even put the inflected pronoun first even though it would be unambiguous: > Him Colonel Mustard killed. You can do that. It's called fronting, and it's not rare in English. It's not a case of the argument order being flexible, but what you said is just plain false. > The only variation in your English examples is with the prepositions. So? > English is a language where you just do not get that kind of flexibility. You mean the kind of flexibility I just illustrated? Or something else? You have a verb with 5 arguments. Two of them go in fixed locations. The other three don't go in fixed locations. It's not a coincidence that the arguments that are free to wander around the sentence are the ones that bear explicit markings of the nature of their relationship to the verb. > The dog the policeman bites. > Stilted and prone to get misunderstood isn't it? Not really. It's not a sentence, though; "the dog the policeman bites" is just a noun phrase referring to a dog. There's no verb. (Bites is a verb, but it's inside a relative clause.)
- inkyoto 9mo ago> I don't know any other language where flexible argument order would work so well. Any highly inflected language has such a property. Slavic languages, Sanskrit (or, more broadly, Indo-Aryan languages) are prime examples. Speakers of Finnish and Hungarian will likely chime in and state something similar.
- ronjakoi 9mo agoFinnish case markers vary a lot from word to word, because of not only vowel harmony but other features of the word stem, and consonant gradation which is a weird feature of Uralic languages. For the subtraction example, some numbers would be 50:tä 5:llä and others 6:tta 3:lla. Of course you could encode for all those possibilities and successfully parse them, but it would feel weird for a compiler to reject an expression because it's ungrammatical Finnish. Also it would feel weird if you first write (vähennä muuttujaa 256:lla) but then realise you made an off-by-1 and have to change it to (vähennä muuttujaa 255:lla) but that doesn't compile because it should be 255:llä, so you have to remember to change two things. But on the other hand, that's just how it is to write in Finnish, so in prose we don't really think about it. In natural language, it's normal to have to change other stuff in a sentence for it to continue making sense when you change one thing.
- readthenotes1 9mo agoOf course, missing https://www.euronews.com/my-europe/2024/10/25/what-is-turkishs-gossip-tense-and-what-does-it-mean-for-disinformation https://www.euronews.com/my-europe/2024/10/25/what-is-turkis...
- rafohy12 9mo ago[flagged]
- pinkmuffinere 9mo agoBoth developers are Turkish
- alpaylan 9mo agoThe Maryland one (that would be me, although I haven’t really done anything except the WASM bindings, this is really all Joomy’s work, kudos to him) is vacationing in Izmir right now, why would that even be important though?
- BigTTYGothGF 9mo agoI don't even live in England but still write in English, heck of a thing if you think about it.
- ugurs 9mo agoClicking the link with a prejudice in my mind, I found the definitions cleverly clean and easy to understand. I would be pleased to see a German version of it, just to have a good laugh.
- abdusco 9mo agoYep. I was expecting to see an existing language (usually Rust) with keywords swapped with Turkish translations, but no, this is actually really nice.
- hexfran 9mo agoNot relevant to the language itself but to the grammar: https://languagelog.ldc.upenn.edu/nll/?p=73 https://languagelog.ldc.upenn.edu/nll/?p=73
- deleted 9mo ago[deleted]
- celaleddin 9mo agoGot especially excited, since I also experimented on a similar idea a few years ago: https://github.com/celaleddin/sembolik-fikir https://github.com/celaleddin/sembolik-fikir Will check this out further in the following days. Thanks for sharing!
- joomy 9mo agoThat's pretty cool! From what I can tell, it does a morphological guess based on the suffix. If you didn't have the apostrophe, it'd have issues with ambiguity (say "aşı", does it mean vaccine or does it mean "aş" in accusative case?) but the apostrophe solves that problem too. My solution for this problem in Kip was to go all the way with the morphological analysis using TRmorph (https://github.com/coltekin/TRmorph https://github.com/coltekin/TRmorph) for it, and then resolve the ambiguities in type checking / elaboration. (Therefore Kip almost never needs apostrophes.) Whether it was worth it, I don't know, but it was a fun problem to solve. :)
- joomy 9mo agoHi all, Kip's developer here! I was going to wait until we had finished the playground and landing page before posting about the project more, but here's the browser-based playground we have so far (thanks to Alperen Keles) for anyone who wants to play with the language: https://alpaylan.github.io/kip/ https://alpaylan.github.io/kip/ (The work on JavaScript transpilation just started today and currently doesn't work, but running the language should mostly work, though it probably has bugs, which I'd love to hear about in the repo's issues!)
- sedatk 9mo agoFantastic work, an area I’ve always wanted to explore.
- nhatcher 9mo agoSorry! It was too beautiful not to share it. But I'm sure you can do a show HN once you think is ready.
- joomy 9mo agoThat's okay, thanks for sharing!
- araes 9mo agoQuestion on some of the syntax. It's neat, and think the idea's cool. Would definitely be something if nothing else for security through obscurity. Is it even code? However, for some of the number stuff, if you write something like: (5'le 3'ün farkını) yaz. (3'ün 5'le farkını) yaz. How does it tell whether it is: 5 - 3 = 2, or 3 - 5 = -2 ? Does it always just return 2 because of the meaning of "farkını" and the placement of 'le and 'ün? Like: (5 first, 3 second, difference) write, vs (3 second, 5 first, difference) write ? Google just gave back: Write (the difference between 5 and 3). Write (the difference between 3 and 5). Not especially familiar with Turkish, and mostly had to use translation, yet it looks like a language for defining math theorems? Number following "zero" shall be called "one", number following "one" shall be called "two". Or is that more just a feature of using natural language for the writing syntax?
- hahahahhaah 9mo agoA language an LLM can choke on!
- chuckadams 9mo agoReminds me a bit of Lingua::Romana::Perligata.
- joomy 9mo agoYes, that's one of my inspirations! I'm writing a short paper about Kip and I'm citing Perligata there for sure. The closest modern non-English programming language I know that also uses grammar features is Tampio, for Finnish. https://github.com/fergusq/tampio https://github.com/fergusq/tampio
- SuperNinKenDo 9mo agoI love this kind of stuff - non-English programming languages, particularly when they utilise language features in unexpected ways like this. My Turkish is pretty rusty - and was never any good anyway, but really cool stuff.
- octoberfranklin 9mo agoIt would be really helpful if this page showed side-by-side comparisons of the same program written in Kip and some other language, like say Haskell. I'm having a hard time seeing how this is much different from record types, except that you're limited to only eight fixed record field names (one for each grammatical case).
- joomy 9mo agoCases essentially act like named arguments, except the names are inferred from the case of an argument, which is inferred through morphological analysis. And that analysis can be ambiguous, so the ambiguities are solved by the type checker / elaborator. It's different from record types in the sense that you can provide the arguments in any order to a function, and the system will figure it out because of the cases.
- octoberfranklin 9mo agoCases essentially act like named arguments ... and there are only eight argument names. Which seems... limiting. It's different from record types in the sense that you can provide the arguments in any order to a function You can provide the fields of a record in any order, and call a function with it! f { foo=3, bar=5 } g { bar=5, foo=3 } I still think the page needs a Rosetta Stone.
- dmurray 9mo ago> ... and there are only eight argument names. Which seems... limiting. I would be fine with a programming language that limited functions to 8 arguments. Not because I never have a use for more, but it's a cost I'd be willing to pay in return for my colleagues never needing more. Pylint and ruff [0] have a check for this that is set to warn over 5 arguments, but I don't think this is enabled by default and I haven't worked anywhere where this would cause the build to fail. [0] https://docs.astral.sh/ruff/rules/too-many-arguments/ https://docs.astral.sh/ruff/rules/too-many-arguments/
- joomy 9mo ago
- tristenharr 9mo agoWoah this is AWESOME! I am going to have to take a look! Love the thoughts, doing something similar at https://logicaffeine.com/studio https://logicaffeine.com/studio Check out Logos lang, would love to chat sometime. love that you chose Haskell!
- Twey 9mo agoThose of a certain vintage might remember Lingua::Romana::Perligata: https://metacpan.org/dist/Lingua-Romana-Perligata/view/lib/Lingua/Romana/Perligata.pm https://metacpan.org/dist/Lingua-Romana-Perligata/view/lib/L...
- Twey 9mo agoI love when the ‘language’ part of programming languages doesn't get left behind :) Very neat!
- Ruidy 9mo agoI have been learning the language because my girlfriend is Turkish. Now I can use my programming brain to fast forward the learning. Amazing
- biddit 9mo agoYep, this was a skillset combination I never envisioned. (am married to a Turk). Maybe a good reason to push past the intermediate plateau.
- hasanabi 9mo agoBetter call it "Kanak".
- timonoko 9mo ago----
- arikana 9mo agoIt seems the order of the parent structure is still following the Anglo-saxon grammar even though lines and pharisees are Turkish , I would like to see something: Fibonacci-Dizisi (n): n 0'a eşitse: dur. değilse: bu-sayıyı yazdır. şu-sayıyı, (bu-sayı + şu-sayı), (n - 1) ile Fibonacci-Dizisi'ne devam et. Ana-Akış: "Bir sayı girin: " yazdır. Girdiyi oku -> girdi. girdi'nin tam-sayı-hali: Yokluksa: "Geçersiz sayı" yazdır. Varlıksa (n): 0, 1, n ile Fibonacci-Dizisi'ni başlat. Başlat: Ana-Akış. nevertheless, that is a good start, congratulations.
- nacozarina 9mo agowith AI every country can migrate development to a programming language that reflects the diction of their unique ethnolinguistic traditions, it's very empowering
- Aerbil313 9mo agoNeat idea. I’m a native Turkish speaker, and when I was first learning English as a kid I remember always being baffled at the extreme chaos and irregularity in English. In the end I learned it mostly by exposure and not from school.