5

In building a language history for Pascal I noticed that at some point languages changed from a strong line between the language and its common libraries to more of a blurry one. In the first few versions of Turbo Pascal there was no capability for reusable modules until version 4 introduced units. Later versions of Pascal had a very powerful collection of common libraries.

With the introduction of Delphi it came with the RTL and VCL. Especially for the RTL, it is often considered part of the language. For example, Exceptions are part of the language, but you need to use the SysUtils unit to get proper handling. Additionally there is the built in System unit that always gets used in all Delphi projects.

Then with Java you have the Java language with the Java run-time and the Java platform. You can't use the Java language outside of the Java platform.

Now with .NET we have VB.NET and C# which are languages that don't exist without their framework either, while Phyton, Ruby and others exist both within .NET and without.

So my question is, is a Language just the syntax and compiler, or is the platform and framework part of the language too? Where is the line? Why or why not?

7
  • 4
    There has always been a run-time library for every language that runs in an operating system. What are you asking?
    – S.Lott
    Jul 28, 2011 at 19:44
  • @S.Lott: My point exactly. I guess my question is if the run-time library is part of the language or not, and if changes to the run-time library constitute evolution of the language. Jul 28, 2011 at 19:50
  • 1
    This question helped me enjoy staying in SE. :) Jul 28, 2011 at 20:48
  • 6
    CounterExample: BrainFuck has no libraries.
    – Job
    Jul 28, 2011 at 21:00
  • 6
    @Job: Counter-counter example: English has many libraries. Jul 28, 2011 at 21:26

7 Answers 7

7

The answer depends entirely on context.

Strictly speaking, the language is just the syntax & semantics of the language and nothing more. Not even the compiler or interpreter counts. There is no "official" compiler for some languages.

If a set of standard functions or a standard object library is part of the abstract language definition, then the library is part of the language even more than any compiler is. For example, the ECMAScript specification contains the description of the standard objects.

7

A language is just the syntax (and semantics), not a compiler or framework or library. Once the specification for the language is known, anyone can, in theory, build a compiler for it. A vendor can ship a library / framework / runtime with a language, but that doesn't mean it is a part of the language itself. ...Though as you can read in the comments below, there are some cases where a few essential core functions or libraries can be referenced in a language specification. And there are probably other languages that don't, but I don't read enough language specifications to know for sure.

9
  • 2
    A programming language isn't just syntax. It also needs semantics of the syntactic constructs allowed.
    – user7043
    Jul 28, 2011 at 19:53
  • @delnan: Ok, but the semantics wouldn't be in framworks or compilers, they'd have to be a part of the language spec. Jul 28, 2011 at 19:58
  • 1
    Yes. I agree with the general idea of your answer, I just have to nitpick.
    – user7043
    Jul 28, 2011 at 20:01
  • What if the language specification frequently references the framework? This actually happens in Java Language Specification, for example.
    – Malcolm
    Jul 28, 2011 at 20:52
  • 1
    I mean the latter, of course. Say, "The direct superclass of an enum type named E is Enum<E>." Enum is a class from the core library. Or: "The unchecked exceptions classes are the class RuntimeException and its subclasses, and the class Error and its subclasses. All other exception classes are checked exception classes." And this directly influences how particular exceptions must be handled in the terms of language. And such mentions happen throughout the whole specification.
    – Malcolm
    Jul 28, 2011 at 21:27
2

I've always considered that a language is defined by two things: the compiler and the standard library. The compiler, obviously, provides the concrete definition and interpretation of the language's syntax and semantics, but IMO it's usually the standard library that has the most influence on the kind of programs that get written with it.

For example, you mentioned Delphi. Delphi is Turing-complete and can theoretically be used to write any computable program. PHP is also Turing-complete and can theoretically be used to write any computable program. But you see a whole lot of GUI-based desktop programs written in Delphi, and a lot of interactive websites in PHP, and not very much the other way around.

Why is that? It's due in large part to the libraries. Delphi ships with the VCL as a standard feature, and a lot of the language design (specifically the changes that differentiate Delphi 1 from Turbo Pascal 7) were originally put in place either to make the VCL work right or to make the VCL's form designer in the IDE work right. Having the gold standard of widget libraries as a standard feature tends to attract people who want to build GUI programs, and it's generally thought of as a RAD language.

PHP, on the other hand, has a bunch of library functions for text processing, HTML templating and database communication. This makes it very easy to build websites with, so it tends to attract people who want to build websites, and it's generally thought of as a Web-scripting language.

2

It seems to me that a number of words have a spectrum of meanings.

For example, body could refer to: your whole body, your body without the head, or your body without arms/legs/head. Similarily, arm could include your hand as part of the arm, or you could look at your arm as distinguish from your hand.

I think language falls into the same category. In its most specific form I think that language refers to the syntax and semantics of that syntax. In its most general form I'd include the syntax, standard library, any external libraries being used, and even style on the part of the programmer.

Right now I'm working on a project written in C++ by someone who clearly has much more experience in C. I'd describe that, in some sense, as being a distinct language "C++--" from the C++ that I'd normally write.

1

I agree with Frustrated. The "language" is only what is defined by the specification for that language, which basically means syntax, keywords and operators, and the behavior of same. Given the specification for, say, C#, an enterprising individual could create a compiler that produces programs that work without the .NET Framework.

Most languages do, however, require some sort of "runtime". Even when working in "unmanaged" languages like C/C++, you could target Windows and the MFCs, or Linux, or even Mac (though Apple tries VERY hard to make sure that Obj-C is the only language used to develop for Apple OSes). This happens by making use of libraries provided by various OSes, which generally allow the program to plug into the OS's GUI and make use of OS-level hardware access tools like OpenGL/DirectX.

We generally don't think of just a collection of libraries as "runtimes", though. Generally, we think of memory-managed "virtual machines" like the JVM and CLR. In addition to libraries for interop, hardware access and common constructs, these platforms provide a memory "sandbox", and "chaperones" like garbage collection and CAS, which further abstract the logic of the program from the nitty-gritty of the specific firmware and hardware on which it executes.

1
  • The standards are very specific about the behavior associated with any piece of syntax. They are very specific that "a = 1 + 1" will set the value of "a" to 2, what type of variable is allowed and what happens if you add +1 to a smallint with a value of 32768. Jul 29, 2011 at 2:01
1

There has always been a fuzzy aspect to answering that question.

Any language requires a standard runtime. For example, you can't run any C program without some kind of runtime. The platform doesn't know how to call main - the runtime library has to provide an entry-point function that is called according to the platforms conventions, parses the command-line parameters, and calls main, then does whatever the platform expects to provide the exit value.

Since there is no universal convention for how all platforms call the entry-point of a program, the runtime must bridge that gap in any language that can run on multiple platforms.

The runtime isn't defined according to the language standard (where an official standard exists) either, so much as to the compiler. For example, few if any languages define the details of call conventions for functions (standard library or otherwise) because these details depend heavily on the platform. So although the set of library types and functions and their behaviour can be defined by a standard, a lot of implementation details aren't.

There can also be surprising interactions between the compiler and the library. Sometimes, when you import a library, the compiler doesn't refer to any kind of header/lib or precompiled module or whatever at all - the compiler replaces the calls with built-in implementations, usually for efficiency reasons.

However, it is normally possible (and sometimes quite practical) to replace most or all of the standard library, right down to the entry-point function. For some parts it requires some assembler coding. Some bits may require some options to be set, preventing the use of those built-in implementations. But replacement is often possible.

Some languages inherently have such a close link between the compiler and the supplied libraries that the only sane way to use an alternative library is to use an alternative compiler too. This is probably more and more the case these days, with the close ties between frameworks like .NET and the Java platform and the languages they support such as C# and, of course, Java.

  • Oops - of course it's very easy to replace the whole .NET or Java platform with an alternative implementation while still using the same compilers, because the platforms themselves are standardized - right down to the virtual machine code. Sorry.

One context where you're probably still relatively likely to see a complete replacement runtime is in embedded systems - but I don't mean mobile phones. More likely, washing machines.

One of Bjarne Stroustrups principles for C++ was that there should be nothing the language can do that the programmer can't. For example, operator overloading is there so that library developers can support operators with types - in C, only the built-in types for the compiler can support operators. There are cases where this requires some assembler programming though - obviously, it's impossible to write a library to provide low-level O/S access and I/O capabilities directly in C++ unless there's already some way to provide low-level O/S access and I/O capabilities.

So that's basically it - you can't completely opt out of having a runtime, but you can opt out of using large parts of it, and you may be able to replace the parts you can't do without, or even replace the whole thing.

1

The "language" is most correctly defined by the standards specification for that language. This could be a CODASYL ISO ECMA etc. standard, but most languages do have a formal or informal standard definition.

So for COBOL the "language" refers to the syntax and behavior associated with the syntax -- for instance its very specific about how numbers are truncated and rounded during arithimatic.

For FORTRAN the "language" as defined in hte standard has always included the syntax, the behavior and the implementation of the standard library. Your compiler cannot be certified as FORTRAN without implementing things like SIN() and PRINTF().

When it comes to JAVA there are a collection of overlapping standards. The syntax and its resulting behavior form the base standard, but there are effectively three languages : Micro, Standard, and Enterprise Edition. They share the same SYNTAX rules but the standards for the Virtual Machine and associated libraries are different. In anything other than a casual conversation I would expect a professional to answer the question "whats it written in?" with "its implemented in Java SE".

So for both precision and for practical purposes the "language" refers to the SYNTAX the expected behavior and its associated run times and libraries.

When one wants to be deliberately more general the phrasing "in most/any ..... dialects" can be used to indicate you are talking about something more general as in:

"In most dialects of BASIC 'LET A = 1 ' will work" or " In any COBOL you cannot perform arithmetic on alphanumeric variables".

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