3
$\begingroup$

When one "downloads" a language (say, downloading the python file, or doing apt-get ruby or something), is it always the compiler/interpreter you are downloading?

In other words, does a "language" ever exist outside of its syntax and behavioral descriptions?

Perhaps standard libraries can be written in the language itself -- but other than that, would it be correct to say that we ever only "download" implementations of the language?

$\endgroup$
  • 9
    $\begingroup$ That really depends on your definition of "download" and "language". If you download the PDF of the ISO Ruby Language Specification, is that "downloading"? Is that "the language itself"? It most definitely is neither an interpreter nor a compiler! $\endgroup$ – Jörg W Mittag May 18 at 21:35
  • 9
    $\begingroup$ Can you "download" a set of integer numbers? A set of words over some alphabet? A mathematical function? A language is just a set of words, equipped with some semantics. In a sense, it's a mathematical object. Usually, it has some kind of operational semantics, and that can be implemented by some program (e.g., interpreter) which we can download. $\endgroup$ – chi May 18 at 22:30
  • 4
    $\begingroup$ Are you are of the difference between a number as a mathematical concepts and its concerete representation as a sequence of digits? It's the same with all mathematical concepts, including programming langauges (which is what they are): you need to distinguish between the abstract concept and its representation. $\endgroup$ – Andrej Bauer May 19 at 9:23
  • 1
    $\begingroup$ You will enjoy learning LISP. Especially after you realized that this only became a real language by accident. $\endgroup$ – Thorbjørn Ravn Andersen May 19 at 19:40
  • $\begingroup$ ‘Do you ever “download” a language?’ Only when you're in the Matrix. — [opens eyes] “I know Hungarian!” $\endgroup$ – gidds May 20 at 8:20
7
$\begingroup$

A programming language is a formal language. Most likely its context-free, sometimes context-sensitive, rarely just regular (mostly eso-langs, and some assembly languages). There usually exists a formal grammar somewhere that defines the syntax of the language. Sometimes, this grammar isn't even written down explicitly and only exists inside the reference implementation of the parser for the interpreter or compiler of the language.

The other part of a programming language is it semantic definition. What does a syntactically valid program do? In case of Java for example, this is defined in the same document that also defines the syntax, the Java Language Specification (JLS). In case of C#, it is defined in as ISO/IEC 23270 Information technology — C# Language Specification.

I'll use the abstract of the latter as example:

This specification describes the form and establishes the interpretation of programs written in the C# programming language. It describes:

  • The representation of C# programs;
  • The syntax and constraints of the C# language;
  • The semantic rules for interpreting C# programs;
  • The restrictions and limits imposed by a conforming implementation of C#.

So what is a programming language? Its mostly a description of its syntax (grammar) and its semantic (what does the program mean).

Now, what do people mean when they "Download [language]"?. Well, in case of Java, they mean that they download a JDK -- one of the many JDKs that conform to the JLS and the acceptance tests (TCK). The reference implementation of Java is the OpenJDK. It contains both a compiler for java (javac) and the JVM, on top of which the bytecode produced by the compiler is run. The JDK thus includes tools to both build/compile Java programs as well as run them.

People usually don't mean they downloaded the language specification when saying that they "downloaded [language]".

Similarly, when people say they "download python" or "download ruby", what they mean is that they download a vm/interpreter that is able to run that language. In case of ruby, most people will likely just use the official reference implementation you can get at ruby-lang.org. But even for ruby other options exist, like JRuby and Rubinius. JRuby runs ruby programs atop the Java VM (JVM).

I've never heard people say they "downloaded C/C++". Its almost always that they say "gcc" or "CLang" or whatever compiler they use. Similarly, people do not say they "downloaded Javascript" when installing Node.

Suffice to say, saying you "downloaded [language]" is almost always imprecise and can lead to confusion, since it is a very colloquial term that can mean very different things for different languages or even people (when I say "download java", do I mean HotSpot? OpenJDK? Coretto? Zulu? Liberica?). Its almost always better to be precise.

| cite | improve this answer | |
$\endgroup$
13
$\begingroup$

A programming language is a formal language, informally speaking a collection of words with a well-formed set of specific rules. As such, you can write down the definition of a formal language and thus a programming language on a piece of paper.

Also, if I've written down somehow digitally the definition of a programming language, surely you can represent and download that description. So then you might talk about an interpreter or a compiler for a language. That is not a programming language, that's an interpreter or a compiler. It's a program you might download.

If the question is "does a programming language exist outside of its description", the answer is no with the above definition: a programming language is defined by a formal language.

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Note that "formal language" in this sense may not be particularly useful, etc. It simply means a definition that will be matched by some set of tokens. Of course actual programming languages you are likely to use do meet those criteria. $\endgroup$ – SoronelHaetir May 18 at 23:20
  • 10
    $\begingroup$ Note that all programming languages I know of also specify semantics (to varying degrees) in addition to the syntax; that might be considered a distinction between a "programming" language and merely a formal language. $\endgroup$ – chrylis -cautiouslyoptimistic- May 18 at 23:43
  • 2
    $\begingroup$ Also, some programming languages only have reference implementations and no completely formal description (grammar, semantics, etc., may be loosely or adequately described, but the implementation does define the language) $\endgroup$ – D. Ben Knoble May 19 at 13:07
  • $\begingroup$ @rexkogitans This is also what my answer mentions ("... that's an interpreter or a compiler. It's a program you might download.") $\endgroup$ – Juho May 20 at 6:57
7
$\begingroup$

You download the language's tools. If the language can be compiled to a "native" executable, (e.g., like "Rust") then you download the compiler, and probably a run-time support library, and maybe a linker, a debugger, etc. If the language requires an interpreter (e.g., like Ruby) or a "virtual runtime environment" (e.g., like Java) then you download those things.

| cite | improve this answer | |
$\endgroup$
2
$\begingroup$

Any Compiler, Interpreter, Assembler performs the task to encode the programming language into strings of binary instructions that the host system's processor could understand.

No matter what high-level programming language you use, the programs needs to be converted into binary strings specific to the instruction-set of the processor.

So on basis of my understanding of the question.

When one "downloads" a language (say, downloading the python file, or doing apt-get ruby or something), is it always the compiler/interpreter you are downloading?

yes when we perform apt install python, we are installing the binaries of the interpreter.

But is it possible to download or install a language in the system?

Suppose if you could modify the microcode of the processor to implement new instructions. Since it is the foundation on which your processor works, at the lowest level you just downloaded/installed/changed-to a new machine language on your system. Now you could program your processor in the new machine language.

In other words, does a "language" ever exist outside of its syntax and behavioral descriptions?

I don't completely understand the question. But if there are bugs in the syntax say like the ambiguity of dangling if else then the program might include working code that the language designer probably did not specified/wanted.

Perhaps standard libraries can be written in the language itself -- but other than that, would it be correct to say that we ever only "download" implementations of the language?

You always download a set of instructions that the host system would understand. It might have been written in some specific programming language. For example when you download a game, it is a collection of binary instructions meant for your processor. When you download a byte code program, it is a collection of instructions for the JVM.

| cite | improve this answer | |
$\endgroup$

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.