Do All Languages Have a Run-Time Environment?

chrstrbrts

Senior member
Aug 12, 2014
522
3
81
Hello,

I know that the Java compiler comes with a run-time environment filled with all sorts of predefined structures (classes, methods, etc.) and apparently, C# Visual Basic, etc. have something similar with the .NET framework.

But do all language compilers come with these environments?

What about "low level" languages like C?

If low level languages don't have these types of environments, can you create your own?

Thanks.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,696
4,658
75
Your terminology is somewhat confusing here. You call this a "run-time environment", but what I think you're referring to is more of a standard library. All languages have a run-time environment of basic keywords (think "int" in Java), but not all have large standard libraries like Java. C++ has a standard class library called the Standard Template Library. Python has one too. So does Ruby.

C doesn't have a class library because, well, C doesn't have classes. ;) It comes with a few standard library functions like qsort and bsearch, but not as many as later languages. But there do exist third-party libraries (of classes, or functions, etc.) for all languages. The only modern language that springs to mind that doesn't have much of a standard library is JavaScript, but there are many third-party libraries out there for JavaScript, the most popular probably being jQuery.
 

Spungo

Diamond Member
Jul 22, 2012
3,217
2
81
I know that the Java compiler comes with a run-time environment filled with all sorts of predefined structures (classes, methods, etc.) and apparently, C# Visual Basic, etc. have something similar with the .NET framework.

But do all language compilers come with these environments?

It's important to note that there's a significant difference between runtime environment and libraries. You can make C++ and Java act very similar in terms of writing code and giving vague instructions like "draw a box, write ___ in the box," but the languages are still as different as night and day. It has everything to do with when things are done. C++ does all of the work before the program runs. The C++ program is a finished product, like a cake. A program written in Java is largely unfinished, like a recipe for a cake. It's up to the runtime environment to build the cake. A language like Perl is even more abstract. 100% of the work is done at runtime. The script doesn't include a recipe. It's a description of what a cake is. The runtime environment needs to create a recipe and the cake.
 

chrstrbrts

Senior member
Aug 12, 2014
522
3
81
Your terminology is somewhat confusing here. You call this a "run-time environment", but what I think you're referring to is more of a standard library. All languages have a run-time environment of basic keywords (think "int" in Java), but not all have large standard libraries like Java.

OK. So, run-time environments aren't standard libraries, but they have certain libraryesque elements? That is, run-time environments have some predefined notion of very basic structures like loops and branches and basic variable types like integers and booleans, yes?

But there do exist third-party libraries (of classes, or functions, etc.) for all languages. The only modern language that springs to mind that doesn't have much of a standard library is JavaScript, but there are many third-party libraries out there for JavaScript, the most popular probably being jQuery.

What are these third party libraries? Are they just snippets of code that you cut and paste? Are they predefined classes and such whose methods you call like in Java?

How would you integrate these external libraries into the "manufacturer's" run-time environment?

It's important to note that there's a significant difference between runtime environment and libraries. You can make C++ and Java act very similar in terms of writing code and giving vague instructions like "draw a box, write ___ in the box," but the languages are still as different as night and day. It has everything to do with when things are done. C++ does all of the work before the program runs. The C++ program is a finished product, like a cake. A program written in Java is largely unfinished, like a recipe for a cake. It's up to the runtime environment to build the cake. A language like Perl is even more abstract. 100% of the work is done at runtime. The script doesn't include a recipe. It's a description of what a cake is. The runtime environment needs to create a recipe and the cake.

OK. So, the run-time environment constitutes an "interpretation" machine for source code. Code means different things to different run-time environments.

How does the compiler fit into all of this? When I downloaded the Java environment, everything came wrapped up together, the compiler, the run-time environment, and the standard library.

Can you separate these things?