7 ms·
Someone should invent a programming language with Runes. It would be cool.
by dear 11y ago
Someone should invent a programming language with Runes. It would be cool.
- jakub_h 11y agoGo uses runes... ;-p
- ars 11y agoAPL uses special characters: https://en.wikipedia.org/wiki/APL_syntax_and_symbols https://en.wikipedia.org/wiki/APL_syntax_and_symbols
- colomon 11y agoYou could get most of the way there with a straightforward module in Perl6: sub infix:<ᛈ>($ᛣ, $ᛤ) { $ᛣ + $ᛤ } my @ᚠᛁᛒ := 0, 1, * ᛈ * ... *; say @ᚠᛁᛒ[100]; Don't know that I'd particularly recommend it, though!
- steve19 11y agoso just business-as-usual for a Perl5 programmer?
- JupiterMoon 11y agoGiven that a monkey with a typewriter could create the full works of Shakespeare with infinite time, could a monkey with a Perl interpreter create a valid Perl program that does your string processing in under 1 minute?
- rspeer 11y agoHere's Python 3: from unicodedata import name as ᚾᚮᛗᚨ ᛊᛈᛚᛁᛏ = str.split def ᚢᚾᛒᛂᚺᚱᛂᚮᛊᚨᚾ(ᚥᚮᚱᛑ): ᚮᚢᛏ = [] for ᛍ in ᚥᚮᚱᛑ: if 'ᚠ' <= ᛍ <= 'ᛪ': ᚾ = ᛊᛈᛚᛁᛏ(ᚾᚮᛗᚨ(ᛍ))[-1] ᚮᚢᛏ += [ᚾ] else: ᚮᚢᛏ += [ᛍ] return ᚮᚢᛏ Apologies if my Old English is crappy, I used Wiktionary.
- nitrogen 11y agohttps://xkcd.com/356/ https://xkcd.com/356/ One would expect it to be possible to #define most of the keywords and functions one would need using the C or C++ preprocessor, though the actual #include and #define macros would still be in Latin script. Unfortunately, the C standard (Annex D of http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf) does not allow runes in identifier names, but it would work for characters explicitly mentioned in the standard and supported by one's C compiler. Here's my attempt: #include <stdio.h> #define _ᚠᛟᚱ for #define _ᛁᚠ if #define _ᛖᛚᛊᛖ else #define _ᚱᛖᛏᚢᚱᚾ return #define _ᛗᚨᛁᚾ main #define _ᛈᚱᛁᚾᛏᚠ(...) printf(__VA_ARGS__) #define _ᛊᛏᚱᛚᛖᚾ(...) strlen(__VA_ARGS__) typedef int _ᛁᚾᛏ; typedef char _ᚲᚺᚨᚱ; _ᛁᚾᛏ _ᛗᚨᛁᚾ(_ᛁᚾᛏ _ᚨᚱᚷᚲ, ᚲᚺᚨᚱ *_ᚨᚱᚷᛒ) { _ᛁᚾᛏ _ᛁ; _ᚠᛟᚱ(_ᛁ = 1; _ᛁ < _ᚨᚱᚷᚲ; _ᛁ++) { _ᛁᚠ(_ᛊᛏᚱᛚᛖᚾ(_ᚨᚱᚷᛒ[ᛁ]) & 1) { _ᚱᛖᛏᚢᚱᚾ("Hello, %s\n", _ᚨᚱᚷᛒ[_ᛁ]); } _ᛖᛚᛊᛖ { _ᚱᛖᛏᚢᚱᚾ("Goodbye, %s\n", _ᚨᚱᚷᛒ[_ᛁ]); } } _ᚱᛖᛏᚢᚱᚾ 0; } Clang and gcc both give errors of this form: rune_c.c:16:2: error: non-ASCII characters are not allowed outside of literals and identifiers _ᛁᚾᛏ _ᛗᚨᛁᚾ(_ᛁᚾᛏ _ᚨᚱᚷᚲ, ᚲᚺᚨᚱ *_ᚨᚱᚷᛒ) ^ I used https://en.wikipedia.org/wiki/Runes#Runic_alphabets https://en.wikipedia.org/wiki/Runes#Runic_alphabets as a reference. For other languages, one should be able to use Ruby metaprogramming to make it possible to write Ruby using nothing but runes and punctuation. One would have to define runic methods to replace the functionality def, class, module, and related keywords, but tricks like instance_eval make that possible.
- moogly 11y agoIt's sad that Chrome on Windows doesn't want to render those Unicode characters. The only mainstream browser that doesn't.
- k8tte 11y agohttps://godoc.org/golang.org/x/text/runes https://godoc.org/golang.org/x/text/runes