3

In my lecture notes "Language Implementation System" is explained as,

A language implementation system provides an interface fro programs in higher level languages to machine instructions.

And after a search Wikipedia gave me,

A programming language implementation is a system for executing computer programs.

But I am having a hard time understanding this concept. Is it talking about something like a JVM (Java Virtual Machine)?

Can someone explain this to me in simpler terms?

1 Answer 1

5

I'll give it a shot.

Programming Language Implementation describes the method for how your code (such as Java) as an example is converted to a language that the machine (processor etc) understand. We refer to this as machine code.

There are 2 main forms of this, compilation and interpretation.

Technically, as the Wikipedia page points out, a compilation is converting one programming language to another (usually a lower level one). Traditionally, this refers to combining multiple input files into a single file that is runnable on the target system.

In an interpreted language, the program is converted piece by piece while it's running on your machine.

You mention the Java Virtual Machine, so I'm going to use that as an example. In the JVM, the Java code is compiled into Java bytecode using javac. This bytecode is then interpreted by the Java Virtual Machine and run on the underlying hardware. This is what the java command does. While Java could be described as a compiled and interpreted language, it's probably easier to think of Java itself as a compiled language, and Java bytecode as an interpreted language.

In contrast, other languages such as C and C++ are usually converted (compiled) directly to the machine code of the target hardware platform.

In addition to these, as @kostix pointed out in the comments, there exists transpiling, or source-to-source compiling. Transpiling refers to converting one higher level language into another higher level one. A common example is converting JavaScript ES6 to JavaScript ES5 for backwards compatibility, or C++ into JavaScript

Sign up to request clarification or add additional context in comments.

4 Comments

I'd rephrase the last sentence to read "…usually converted (compiled) directly to the machine code of the target hardware platform".
I'd also note that the term "compilation" is itself a bit moot when we talk about converting a program written in a high-level PL into something low-level, like machine code. That's because the origin of that word is rooted in the compiler being able to combine code from multiple inputs (usually files) into a single program runnable on the target system.
To make what I mean maybe more clear, there exist the term transpiling which—these days—is mostly used to describe conversion of a program from one high-level language into another, such as C++ into JavaScript.
Added to the answer. Not sure its necessary to mention the origins of the word "compilation", however..unless I'm missing something

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.