47
\$\begingroup\$

Challenge:

In the programming language of your choice, take no input and output your programming language's name.

Fair enough, right?

Restrictions:

  • You can't use any character that is included in your programming language's name in your code. E.g., if I use Batch, I must not use the chars 'B' 'a' t' 'c' 'h' in my code. Note that this is case sensitive. I can still use the char 'b' because it's different from 'B'.
  • You can have "junk output" before or after the name of the language
  • Version number doesn't count as part of the name of the language. E.g., I can use the number 3 in the code in my answer if it's in Python 3
  • The output of the programming language name is not case sensitive.
  • Brute-forcing all possible letter combinations and hoping you get your language name is forbidden.

Example outputs: (let's say my programming language is called Language) (✔ if valid, else ✖)

  • Language
  • Body language is a type of non-verbal communication in which physical behavior, as opposed to words, is used to express or convey information. Such behavior includes facial expressions, body posture, gestures, eye movement, touch and the use of space.
  • Language 2.0 - © 1078 AD some company
  • foobar

This is thus shortest code wins.

\$\endgroup\$
15
  • 8
    \$\begingroup\$ The rule about case sensitive restrictions is very ambiguous. Which is the correct orthography: BASIC Basic or basic? I'm pretty sure I can find examples for all three. \$\endgroup\$ Jan 24 '17 at 23:47
  • 7
    \$\begingroup\$ Obligatory "Just having your code be blank but have a flag like --version isn't allowed"? \$\endgroup\$
    – Value Ink
    Jan 25 '17 at 0:00
  • 97
    \$\begingroup\$ Have case-insensitive output while banning the language name case-sensitively allows boring solutions that just output the language name case-swapped. \$\endgroup\$
    – xnor
    Jan 25 '17 at 0:47
  • 14
    \$\begingroup\$ You made a mistake by allowing users to output junk data. All they have to do is use a language where the compiler include the name whenever there's an error. It's cool but not the challenge I was hoping for \$\endgroup\$
    – Lynob
    Jan 26 '17 at 8:23
  • 3
    \$\begingroup\$ This question really needs to be specified that "Code" must be run. Most languages will show their name in the usage dump if you don't give any code--for instance "Java" or "Groovy" at the command line with no code will display the correct name, however if you pass code (even "empty" code) as in (groovy -e "") you will get an empty response. Same for compile problems, the compiler usage or error output does not mean you wrote a program. \$\endgroup\$
    – Bill K
    Jan 26 '17 at 18:30

149 Answers 149

1 2 3 4
5
1
+50
\$\begingroup\$

Forth (gforth), 1 byte

]

Try it online!

] switches to compile state, causing following words to be executed with their compilation semantics... and apparently, if the program never returns to interpret state, also causing it to output

Gforth 0.7.3, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit

I thought maybe there was some chance I could get around having to create a definition to use loops for another challenge, but this works too.

\$\endgroup\$
1
\$\begingroup\$

<>^v, 14 bytes

60\62\94\118\`

Pushes to stack the character's index in ASCII, then prints them, and prints a newline.

run online

\$\endgroup\$
1
\$\begingroup\$

Java (JDK), 0 bytes

Ties OrangeDog's Java answer, nigel222's Python answer, Cees Timmerman's C answer, Loovjo's Vim answer, Noodle9's Vim answer, James Holderness's Befunge answer, Alex Howansky's PHP answer, Flambino's huh? answer, NoOneIsHere's Quetzalcoatl answer, Matthew Roh's C answer, G B's Erlang answer, cp.fe.cp's TeX answer, BlackCap's UPL answer, Rajan Kumar's Go answer, lyxal's Keg answer, user92069's 05AB1E answer, madlaina's Rust answer, and tail spark rabbit ear's Pxem answer for #1.

Try it online!

Output (stderr)

Error: could not find or load class Main
Caused by: java.lang.ClassNotFoundException: Main

Python 3, 0 bytes

Takes a command-line option not in this list:

-B
-b
-c
-d
-E
-I
-i
-O
-q
-S
-s
-u
-W
-X
-x
\$\endgroup\$
1
\$\begingroup\$

Vyxal h, 0 bytes


Try it Online!

-3 thanks to Lyxal

\$\endgroup\$
0
0
\$\begingroup\$

Pascal, 47 bytes

BEGIN WRITE(UpCASE('p'),LOWERCASE('ASCAL'))END.

Output:

$ ./g
Pascal$

Alternative boring way, 25 bytes:

BEGIN WRITE('pASCAL')END.

Output:

$ ./g
pASCAL$
\$\endgroup\$
1
  • \$\begingroup\$ You can't use P, A, S, C, A or L in your source code. \$\endgroup\$
    – Clearer
    Feb 14 '17 at 1:49
0
\$\begingroup\$

Python, 0 bytes (cheating?)

$ python
Python 2.7.13 (default, Jan 13 2017, 10:15:16) 
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

python is a shell command not a language command. It could equally be xyzzy if I have previously done

$ ln -s $( which python) xyzzy

Or just x (one byte, if you insist on counting the shell command as well).

\$\endgroup\$
4
  • 1
    \$\begingroup\$ I think you have to mark this as "Python (REPL)", because we've decided that a REPL is a different language from the language itself. Apart from that, though, I don't see why it wouldn't work; "REPL" is not part of the language's name. \$\endgroup\$
    – user62131
    Jan 25 '17 at 13:51
  • \$\begingroup\$ You're not allowed to use the characters contained in the language's name. \$\endgroup\$
    – mbomb007
    Jan 25 '17 at 14:56
  • \$\begingroup\$ x or xyzzy don't use characters contained in the languages name. I thought a little explanation was in order. Maybe cheating though, in that the python interpreter prints its own name by default. \$\endgroup\$
    – nigel222
    Jan 25 '17 at 15:33
  • \$\begingroup\$ This is what I considered to submit, but decided for something else. IMHO this is valid, because invoking the programming language itself does not mean you are using the name as part of the code - (almost) any other answer needs to call the interpreter or compiler anyway if you want to actually run the program! \$\endgroup\$ Jan 25 '17 at 16:01
0
\$\begingroup\$

Scala. 11 bytes

1##

Run with scala -feature /path/to/file.scala (+8 bytes for -feature).

Outputs:

/path/to/file.scala:1: warning: a pure expression does nothing in statement position; multiline expressions may require enclosing parentheses
1##
 ^
/path/to/file.scala:1: warning: postfix operator ## should be enabled
by making the implicit value scala.language.postfixOps visible.
This can be achieved by adding the import clause 'import scala.language.postfixOps'
or by setting the compiler option -language:postfixOps.
See the Scaladoc for value scala.language.postfixOps for a discussion
why the feature should be explicitly enabled.
1##
 ^
two warnings found
\$\endgroup\$
0
\$\begingroup\$

Del|m|t, 25 bytes

TIO

= : Abiyjyq / 2 > ? # * !

No command line arguments, so the starting delimiter is .

Explanation:
Format: (token) command effect

(=) 29        jump command - no-op the first time through, skips 1 command the other times
(:) 26        Pushes the following String backwards. Only happens once
(A...) 25     "Del|m|t" shifted down by 3. Also the "print char" command
(/) 15        Duplicates top value
(2) 18        Nots the top, used in order to check if we printed everything
(> ?) 30, 31  If we did, end the program
(# *) 3, 10   Add 3 to the value, setting each character back to the desired "Del|m|t"
(!) 1         Pushes 1, which makes the first command skip the pushing of the string.
              This then causes the string "Abiyjyq" to print the top value when we repeat.

The trick here is using the String Abiyjyq to both encode the string Del|m|t, and print the top of the stack as a character. Thankfully, no character in Del|m|t is also in Abiyjyq, because the is in the language name are replaced with |s

\$\endgroup\$
0
\$\begingroup\$

Brainelly, 36 bytes

ƑA$ƒṃƁẸḷ-ṚżƁẸH/ƑKƁƊṄ$Ƒ9$⁾ṃmṚỤ$Ƒ7EṢṘ{

Original Brainfuck code:

++++[++++>---<]>-.---[----->+<]>-.+++[->+++<]>++.++++++++.+++++.---------.+++++++..-[--->+<]>.

With a no-op inserted to avoid the character restriction:

++++[++++>---<]>-.---[----->+<]>-.+++[->++++-<]>++.++++++++.+++++.---------.+++++++..-[--->+<]>.

\$\endgroup\$
0
\$\begingroup\$

Stacked, 30 + 1 = 31 bytes

+1 for p extension. Call like:

node stacked.js -pe "(115:1+97:2+107:6-:1-)#:''join"

(where e is the execute flag.) The p prints the top of the stack at program end. The output is 'stacked'.

Explanation

(115:1+97:2+107:6-:1-)#:''join
(                    )           array containing these
 115                             [115, 
    :1+                                115+1,
       97                                     97,
         :2+                                      97+2,
            107                                         107,
               :6-                                           107-6,
                  :1-                                               107-6+1]
                      #:         cast each number to a character
                        ''join   join by empty strings

Example usage

λ node stacked.js -pe "(115:1+97:2+107:6-:1-)#:''join"
'stacked'
\$\endgroup\$
0
\$\begingroup\$

8th, 4 bytes

.ver

Output is as follows:

8th 16.14 WIN64 Free (6362ab32) custid: ########

I blanked my custid with ########

\$\endgroup\$
0
\$\begingroup\$

JavaScript (REPL), 42 bytes

'\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74'
\$\endgroup\$
0
0
\$\begingroup\$

Pyth 8 bytes

r"pYTH"2

Try it online

\$\endgroup\$
0
\$\begingroup\$

JAVA, 21 byte

throw new Exception();

print

Exception in thread "main" java.lang.Exception

Full program :

public class OutputProgrammingLanguageName {

  public static void main(String[] args)throws Exception {
    throw new Exception();
  }
}
\$\endgroup\$
3
  • 1
    \$\begingroup\$ This isn't a complete program or function. \$\endgroup\$
    – Pavel
    Jan 27 '17 at 18:26
  • \$\begingroup\$ Also the complete program contains a and v \$\endgroup\$
    – Metoniem
    Feb 21 '17 at 10:34
  • \$\begingroup\$ @Metoniem then that would means it's impossible in java since you always have main \$\endgroup\$
    – Walfrat
    Feb 21 '17 at 11:40
0
\$\begingroup\$

dc, 6 bytes

Eo194p

Outputs DC. Alternatively, so does this:

Fo207p

The only bases in which dc can output the letter D as part of a number are 14, 15 and 16, but I don't know if it's possible to express 16 using a single byte.

\$\endgroup\$
0
\$\begingroup\$

C (gcc), 0 bytes

<Yep, you read it right, 0 bytes.>

According to TIO, it outputs:

usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
/srv/wrappers/c-gcc: line 5: ./.bin.tio: No such file or directory
\$\endgroup\$
1
  • \$\begingroup\$ Good use of gcc arguing when theres absolutely nothing. \$\endgroup\$ Feb 5 '17 at 14:45
0
\$\begingroup\$

REXX, 21 bytes

parse version a
say a

Will give something like

REXX-Regina_3.9.1(MT) 5.00 5 Apr 2015

or

ARexx V1.15 68070 68881 PAL 50HZ
\$\endgroup\$
0
\$\begingroup\$

Erlang, 0 bytes

As many other languages, starting the interactive interpreter shows the language name and version.

\$\endgroup\$
0
\$\begingroup\$

TeX and variants (0 bytes)

Inputting an empty file or just running tex on the command line leads to an output on the console screen starting with

This is TeX, Version 3.14159265

This also works for pdfTeX, LuaTeX and XeTeX, but not for the LaTeX-variants (the "La" doesn't get printed).

Since this is TeX, I would like to also be able to produce a DVI or PDF with the TeX logo in it, but I have not yet been able to find a way around the restrictions. Simply \TeX\bye for plain TeX does work, but contains all letters in the name at least once. The LaTeX variant is even worse with \documentclass{book}\begin{document}\LaTeX\end{document}, which contains the e 6 times. For both, commands containing an e are obligatory to have a valid document. Maybe there's a way around this with some smart redefinitions, but since many macros in TeX contain the letter e I doubt it will be easy.

\$\endgroup\$
1
  • \$\begingroup\$ You can use TeX's ^^ replacing mechanism to insert characters without explicitly typing them (see full explanation here). This leads to \^^54^^%^^58\^^%nd as the shortest full TeX document solution, IMO. \$\endgroup\$
    – siracusa
    Mar 27 '18 at 10:16
0
\$\begingroup\$

Julia 0.6.0 (13 bytes)

versioninfo()

Pretty boring answer, but Julia had to be represented! ;)

of course just opening Julia tells you the name... But I don't know if that's a valid answer

\$\endgroup\$
1
  • 3
    \$\begingroup\$ i is a part of Julia. you can't use it in your answer. \$\endgroup\$
    – Uriel
    Jul 27 '17 at 19:14
0
\$\begingroup\$

Bean, 8 bytes

xxd-style hexdump

00000000: 2381 00e2 e5e1 ee20                      #..âåáî 

Try it online!

Equivalent JavaScript

"bean "

Strings (and non-standard identifiers) in bean are encoded by using the high bit to determine whether to continue reading the packed bytes as part of the string, since the only supported strings in bean are ASCII and the high bit would otherwise be unused.

Since the last character in the packed bytes for a string does not have the high bit set, it must not be one of the characters in the language name because it is equivalent to the last character in the correlating string in the source and characters from the language name are restricted from the source.

Therefore, the last 5 characters in the ISO/IEC_8859-1 encoded bean source are âåáî followed by a space. You can confirm that these characters correlate to bean by checking this script:

let string = Array.from("âåáî").map(character => {
  const code = character.charCodeAt(0)
  return String.fromCharCode(code & 0x7F)
}).join("")

console.log(string)

\$\endgroup\$
0
\$\begingroup\$

Perl 5, 1 bytes

Includes +1 for -v

Try it online!

(the body is empty). This includes both perl and Perl. But I'm going to assume the language name is perl from here on. It's what perl's own version string says the name is after all.

This is of course totally boring. Somewhat more interesting:

Perl 5, 6 bytes

say$^X

Try it online!

This assumes the name of the executable contains perl. I've yet to see an install where this is not so.

Perl 5, 11 bytes

say"\LPERL"

Try it online!

Uses the fact that case variations don't count. I couldn't use lc because it contains l. Still boring

Perl 5, 12 bytes

say FSDZ^6x4

Try it online!

This one clean but long

\$\endgroup\$
0
\$\begingroup\$

33, 1 byte

~

Any character not recognised by the interpreter will print the message 33 (<location>): Unrecognised token. In this case, the location would be 1:1.

Non-stderr version, 3 bytes

btp

The mutable list is initially filled in with argv, with the first element of that normalised to be "33". This takes 33 from the list, puts it in the source string, then prints it.

\$\endgroup\$
0
\$\begingroup\$

Rockstar, 8 bytes

Probably the only time Rockstar will ever come close to being competitive!

rOCKSTAR

Try it here (Code will need to be pasted in)

\$\endgroup\$
0
\$\begingroup\$

CSASM v2.1.2.3, 108 19 bytes

func main:
abs
ret
end

The abs instruction throws the following error if no values were on the stack:

StackException thrown in compiled code:
   Stack underflow detected. Cannot pop more objects from the stack.
   at CSASM.Core.CSASMStack.Pop()
   at CSASM.Core.Ops.func_abs()

Any of the 3-character instructions that pop a value from the stack would also work for this answer.

\$\endgroup\$
0
\$\begingroup\$

Branch, 21 bytes

66.114.97.110.99.104.

Try it on the online Branch interpreter!

Not the most exciting answer. An answer with no numbers though:

Branch, 74 bytes

/^\^'/;c;^+/;c;^'/;c;^*N/;^*}}./;c;^+/;cn^-{{.O/;cn^-{./o{{{{.^}}./{{{{{{.

Try it on the online Branch interpreter!

\$\endgroup\$
0
\$\begingroup\$

x86 machinde code - 12 bytes

Borrowed code from qwr's answer.

 8048054:   b8 1a dd 2c 11          mov    eax,0x112cdd1a
 8048059:   2d de c0 11 11          sub    eax,0x1111c0de
 804805e:   d1 e0                   shl    eax,1
\$\endgroup\$
0
\$\begingroup\$

A0A0, 15 bytes

P65
P48
P65
P48

P prints the character corresponding to the ASCII value next to it. Luckily for me, none of the ASCII values needed have a zero in them. If the requirement of not containing the characters of your language wasn't there, this could be improved by two bytes by swapping out the P48 for O0 which prints the numeric value after it, so zero.

One column is the most optimal layout for this text. Two columns would add 2 bytes to the total.

\$\endgroup\$
0
\$\begingroup\$

JSFuck (JScrewIt Firefox), 1053 bytes

(+(!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+[+[]]+(+!![])+(!![]+!![]+!![])+(+!![])+(!![]+!![]+!![]+!![]+!![])+(+!![])+(!![]+!![]+!![])+(!![]+!![])))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+!![]]+(!![]+[])[+[]]])[+!![]+[+[]]]+([]+[])[([]+[][(![]+[])[+!![]]+(!![]+[])[+[]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+!![]]+(!![]+[])[+[]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+!![]]+(!![]+[])[+[]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+!![]]+(!![]+[])[+[]]])[+!![]+[+[]]]+(!![]+[])[+!![]]][([][[]]+[])[+!![]]+(![]+[])[+!![]]+([]+(+[])[([]+[][(![]+[])[+!![]]+(!![]+[])[+[]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+!![]]+(!![]+[])[+[]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+!![]]+(!![]+[])[+[]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+!![]]+(!![]+[])[+[]]])[+!![]+[+[]]]+(!![]+[])[+!![]]])[+!![]+[+!![]]]+(!![]+[])[!![]+!![]+!![]]]](!![]+!![]+!![]+[!![]+!![]+!![]+!![]])

Try it online!

Requires Firefox nightly for Array.prototype.at, or you can use the following polyfill on any browser:

Array.prototype.at = { constructor: Function.prototype.constructor, toString: () => "function at() {\n    [native code]\n}" };
\$\endgroup\$
1 2 3 4
5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.