# May I create my own programming language, which uses an existing compiler?

So, I like golfing, and I like modern C++. I am golfing in regular C++(11(14)) now, so obviously, I did not win a single challenge yet. I noticed, that both Pyth and CJam (probably languages, that win most of the time) were designed entirely for this purpose. I thought at designing my own language as well.

But, I would like the language to be based on C++, probably using same structure, with STL, with shortened keywords and so. However, I do not think I am skillful enough to write my own C++ compiler, so I thought I would use existing one.

My question is, if I create a language Placeholdername, with such compiler, that it will parse Placeholdername source code into C++ code, and then calls C++ compiler to produce executable, can I compete in code-golfs with such language?

• What you're describing is exactly how Pyth works. So go ahead. Nov 24 '15 at 0:32
• @isaacg Though I am remiss to disagree with the creator of the language, I'd say Pyth has evolved into something much more than shortened Python.
– user45941
Nov 24 '15 at 0:40
• Lots of JavaScript shortener languages like Japt and ESMin do this technique.
Nov 24 '15 at 0:44
• @Mego I was responding to the sentence "It will parse Placeholdername source code into C++ code, and then calls C++ compiler to produce executable" as the thing Pyth does. Not the idea as a whole. Nov 24 '15 at 0:47
• @isaacg Oh lol, I thought you were saying Pyth was just shortened Python. On-topic, Seriously does sort of the same thing too, except it's interpreted rather than transpiled.
– user45941
Nov 24 '15 at 0:48
• C++154? That's interesting ;) Nov 30 '15 at 15:45
• @CᴏɴᴏʀO'Bʀɪᴇɴ ? Nov 30 '15 at 18:05
• Sorry, bad joke. C++(11(14)) = C++(11*14) = C++154 Nov 30 '15 at 18:28
• @CᴏɴᴏʀO'Bʀɪᴇɴ I see :) Nov 30 '15 at 19:13
• Typically this is called transpiling, which a lot of languages to. Unary, for instance, is transpiled into BrainFuck before being executed. This is important because Unary programs tend to be larger than any possible storage medium. Aug 13 '17 at 21:48

# Yes

Many languages already do this, such as Pyth and Japt. It's completely ok to create a language that compiles to another language.

Though if you've seen o.c, you'll know that C can be golfed quite well ;)

• If you've seen o.c, you'll know why one should never golf an interpreter. Nov 24 '15 at 2:25

Do you want to create a language just so you can use it on this site or do you have a higher purpose for that language? Basically what happens is that since it's incredibly easy to design and implement an esolang you can write one in just a day. However, the drawback of that is, that there will be little to absolutely NO COMPETITION within that language because nobody else is using it (because everybody is creating their own languages for little actual benefit). I'd recommend looking at an existing golfing languages and learn one rather than inventing yet another one so we actually have decent competition going on in golfing languages. Be it Pyth, CJam, Flogscript, Golfscript or whatever. There are already plenty of these languages.

• I would disagree with this. If a language that some user (e.g. aditsu) created is really good (CJam) it will automatically gain popularity... Also, if you create an esolang, chances are that you want to make it different from the others.... Nov 29 '15 at 8:28
• Yeah but you're very limited with "how different you can make it". Mainstream languages differ in several ways but the most different way is the fact that they have different looking syntax and different module systems. Other than that most of them are alike. This is even worse for esoteric programming languages. Most of the esoteric languages have so much overlap they are practically they same language. Sure, Language A uses \$ for pop, Language B uses p for pop but in the end it's the same thing. Nov 29 '15 at 8:54
• Sure, every language has it's little quirks that may help for certain challenges but whatever. In golfing languages it's about mapping as much functionality to as few characters as possible. GS2 for example uses even non-printable and non-ascii characters to accomplish that but other than that they are more or less all the sime. (With the notable exception of non-stack based golfing languages). But honestly I don't really see the benefit if everyone creates his own language to compete and "win" rather than having good competition in mutually agreed upon languages. Nov 29 '15 at 8:58
• That doesn't mean he can't create his own language. By all means he should do that because it is fun. The thing is the asker said "didn't win any yet" and that's in my opinion not a good motivation. If you create a language just with the intention so you can win a challenge? That's not good sportmanship. Nov 29 '15 at 9:00
• Just browse the esowiki for some time. There are hundreds of Brainfuck derivatives because people want to create their own esolangs (usually for ego-reasons) but they are not very clever usually. It's so easy to create an esolang that you can actually write a generator for it that randomizes between tape based, stack based, imperative ... and randomly generates instructions etc. Nov 29 '15 at 9:03
• Also look at anarchy golf or other golfing sites. There are soo few people who golf regularly it just plain kills competition if the golfers are distributed to so many languages. Nov 29 '15 at 9:08
• Wow, those are good arguments! You might want to update your answer with them... Nov 29 '15 at 9:14
• Also consider for example LISP-like golfing languages. (while (f) (set f (div f 3)). That's how you'd do it in plain LISP. Now somebody created a golfing language where this becomes (w f (: f (/ f 3)). This is obviously shorter but it's the same program. What do you gain in terms of "golfing challenge"? Nov 29 '15 at 10:45
• It looks cooler? :P Nov 29 '15 at 10:52
• @mroman So if it's pointless how do new golflangs gain popularity :P e.g. V, Jelly, 05AB1E, Actually, SOGL, Charcoal etc. which were all written after the most recent comment :P Aug 15 '17 at 12:49
• They look cooler :D. Aug 17 '17 at 12:19