4 ms·
文言 – A programming language for the ancient Chinese
- forkLding 7y ago这是哪路大神写的?
- sequoiar6868 7y ago穿越时空来的 诗人。有趣。
- vxxzy 7y ago與C語言相比,它的性能如何
- lioeters 7y agoThe Mandelbrot example, as well as the Fibonacci one, I find quite beautiful. https://github.com/LingDong-/wenyan-lang/blob/master/examples/fibonacci.wy https://github.com/LingDong-/wenyan-lang/blob/master/example... I think ancient Chinese people would be proud and awed by seeing how language becomes a living thing, performing logical operations. Maybe because my only attempts at studying Chinese was the Tao Te Ching, the programs written in 文言 feel like they're expressing universal truths.
- tvvocold 7y ago歪个楼,欢迎朋友们加入 Hacker News 中文社群:https://t.me/hn_china https://t.me/hn_china
- duschang27 7y agoThank you for this. I never thought a javascript compiler could help me improve my Chinese reading skills.
- tasogare 7y agoIn the same spirit, Kanbun (Japanese annotations for reading Classical Chinese) can be described in a mathematical way: https://researchmap.jp/?action=cv_download_main&upload_id=24891 https://researchmap.jp/?action=cv_download_main&upload_id=24... I personally tried to make a virtual machine for transforming texts (texts are code and data) in kanbun before I found the paper but failed because it's a bit more difficult than I excepted.
- lioeters 7y agoThat paper is mind-blowing.. It seems to be describing a mapping from Chinese to Japanese, using algebraic/functional transformations (a few mentions of monoid) - and the equivalence of this projection is proven using the inductive method. (A bit confusing how the lambda symbol is used to represent a null string.) The concept of a "mathematical structure of language" is quite intriguing. Maybe I'm a bit biased (Japanese is my mother tongue) but I get the impression that the Chinese language is particularly suited for mathematical representation? Like in this 文言 programming language, the sentences seem to read naturally (not sure if they're grammatically correct though). My favorite take-away from this post: in the Turing machine example, the program is titled 「圖靈機」. I see that 圖靈 is a phonetic spelling of Turing ("tú líng"), but the literal meaning of these characters combined feels like "map/scheme/plan of a spirit machine" (I guess that would be more correct as 霊機図).
- tasogare 7y agoFrankly I didn't understand everything in the paper because of the maths/language involved but yes it's a super interesting read. The author has other papers (including new ones!) on his website: http://www.wasanjyorin.com/ http://www.wasanjyorin.com/ (under section 漢文訓読関係 of course). I don't think that Chinese is more suitable for maths representation per se than other any other natural language. It's the difference between Chinese SVO and Japanese SOV that gave birth to kaeriten and the crazy idea of reading a text in a foreign language in it's own mother tongue by reordering the words. It gives this assembly-like feel to the whole thing, where kanji=memory cells and kaeriten=instructions. My Classical Chinese game is not too strong, but from what I understand the programming language presented is indeed very well crafted.
- lioeters 7y agoThanks for the link to the author's site - most of it's over my head, but I love how deep he's into this particular topic. Browsing the papers, like 数理漢文学への道 (the road to the "mathematical study of Chinese literature"..?), I see that the reality of working with a natural language is fraught with exceptions and ambiguities, requiring more and more logical rules to be added in order to closely represent the real-life usage of grammar. So I think you're right that Chinese is not necessarily easier than any other language, to diagram this way. It's due to my lack of knowledge, that I imagined Chinese grammar to be more strictly logical than, say, English which is well-known for its quirks and idiosyncracies. In a way, the approach of mathematically representing a natural language reminds me of earlier years of AI research before machine learning - like expert systems and inference engines - to manually build models of knowledge and mental processes. (Well, in the case of this kundoku research, it looks like it's concerned with the syntax structure only, and not about the content/meaning of the words and characters.) > It gives this assembly-like feel to the whole thing, where kanji=memory cells and kaeriten=instructions. Wonderful imagery - I can see why you were working on "a virtual machine for transforming texts (texts are code and data) in kanbun". I didn't get it before, but when you said "texts are code" - now I see that you were feeding kanbun text into a VM that interpreted it as code..!? A somewhat related topic I'm interested in is mathematical representations of music. It feels like a similar endeavor, to build up a set of logical rules to attempt to model the real-life usage of musical "grammar". There are so many exceptions and "illogical" (i.e., strangely dissonant) ways that people express themselves, that will always be "one step ahead" of any set of rules. (On the other hand, there are some fascinating examples of algorithmic music, beyond what humans are able to create.) Anyway, thank you for an introduction into a thought-provoking topic.
- k_sze 7y agoIt would be even more amazing to have a TypeScript extension, as in adding more syntax so that 文言 transpiles to TypeScript first, then to JS.
- pascoej 7y agoThe author is prolific, having made ton of amazing projects over the past few years. https://lingdonh.itch.io/ https://lingdonh.itch.io/