19
\$\begingroup\$

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?

\$\endgroup\$
10
  • 20
    \$\begingroup\$ What you're describing is exactly how Pyth works. So go ahead. \$\endgroup\$
    – isaacg
    Nov 24, 2015 at 0:32
  • 1
    \$\begingroup\$ @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. \$\endgroup\$
    – user45941
    Nov 24, 2015 at 0:40
  • \$\begingroup\$ Lots of JavaScript shortener languages like Japt and ESMin do this technique. \$\endgroup\$
    – jado
    Nov 24, 2015 at 0:44
  • 3
    \$\begingroup\$ @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. \$\endgroup\$
    – isaacg
    Nov 24, 2015 at 0:47
  • 1
    \$\begingroup\$ @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. \$\endgroup\$
    – user45941
    Nov 24, 2015 at 0:48
  • 1
    \$\begingroup\$ C++154? That's interesting ;) \$\endgroup\$ Nov 30, 2015 at 15:45
  • \$\begingroup\$ @CᴏɴᴏʀO'Bʀɪᴇɴ ? \$\endgroup\$
    – Zereges
    Nov 30, 2015 at 18:05
  • 5
    \$\begingroup\$ Sorry, bad joke. C++(11(14)) = C++(11*14) = C++154 \$\endgroup\$ Nov 30, 2015 at 18:28
  • \$\begingroup\$ @CᴏɴᴏʀO'Bʀɪᴇɴ I see :) \$\endgroup\$
    – Zereges
    Nov 30, 2015 at 19:13
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ Aug 13, 2017 at 21:48

2 Answers 2

25
\$\begingroup\$

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 ;)

\$\endgroup\$
1
  • 23
    \$\begingroup\$ If you've seen o.c, you'll know why one should never golf an interpreter. \$\endgroup\$
    – Alex A.
    Nov 24, 2015 at 2:25
-16
\$\begingroup\$

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.

\$\endgroup\$
11
  • 1
    \$\begingroup\$ 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.... \$\endgroup\$
    – Stefnotch
    Nov 29, 2015 at 8:28
  • \$\begingroup\$ 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. \$\endgroup\$
    – mroman
    Nov 29, 2015 at 8:54
  • \$\begingroup\$ 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. \$\endgroup\$
    – mroman
    Nov 29, 2015 at 8:58
  • \$\begingroup\$ 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. \$\endgroup\$
    – mroman
    Nov 29, 2015 at 9:00
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – mroman
    Nov 29, 2015 at 9:03
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – mroman
    Nov 29, 2015 at 9:08
  • \$\begingroup\$ Wow, those are good arguments! You might want to update your answer with them... \$\endgroup\$
    – Stefnotch
    Nov 29, 2015 at 9:14
  • 1
    \$\begingroup\$ 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"? \$\endgroup\$
    – mroman
    Nov 29, 2015 at 10:45
  • 2
    \$\begingroup\$ It looks cooler? :P \$\endgroup\$
    – Stefnotch
    Nov 29, 2015 at 10:52
  • \$\begingroup\$ @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 \$\endgroup\$
    – ASCII-only
    Aug 15, 2017 at 12:49
  • \$\begingroup\$ They look cooler :D. \$\endgroup\$
    – mroman
    Aug 17, 2017 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .