Please elaborate the difference.

Write your answer…

5 answers

In simple terms, this is the difference:

Native Compiled language: You write your code, you run the compiler and the compiler turns it into machine instructions (raw bytes) that the CPU itself can read and execute.

Interpreted language: You are writing a script and handing it to another program which executes code on the script's behalf. This "other program" is called the interpreter or the engine and it itself is usually a native compiled program, hence it has to at some point give machine code to the CPU; everything does because that's the only way to actually get the computer to do anything. Simply put - a script is a set of instructions for a program to execute whereas a native binary is a set of instructions for your machine's CPU to execute.

The key here is that, since with scripting, you don't have to "compile to machine code," that's why when you write a script you don't have to "build" it; you can just feed it straight into the interpreter which speeds up the overhead of writing/testing code a bit. The downside is that the interpreter itself has overhead because many more steps are involved than simply the machine reading one compiled program.

If you want to see all this in action, get on Windows and write yourself a real basic javascript script. Now, download x64Dbg and open up `C:\Windows\System32\wscript.exe` in x64Dbg with commandline args to launch the javascript script you just wrote. You can actually trace the script's behavior in the wscript.exe binary and that's because the wscript.exe binary is following the instructions of the javascript file but the javascript file itself cannot at all tell the computer what to do directly. wscript.exe is an \__interpreter.

Spot On1
High Five1

Hashnode is building a friendly and inclusive dev community. Come jump on the bandwagon!

  • 💬 A beginner friendly place

  • 🧠 Stay in the loop and grow your knowledge

  • 🍕 >500K developers share programming wisdom here

  • ❤️ Support the growing dev community!

Register ( 500k+ developers strong 👊)

EntityProgramming LanguageScripting Language
DefinitionA programming language is an artificial language designed to communicate instructions to a machine, particularly a computer.A scripting language, script language or extension language is a programming language that allows control of one or more applications.
TypeCompiler-based languageInterpreter based language
UsageDeveloping something from scratchUsed to combine existing components
RunningRun independent of an exterior (or parent) programRun inside another program
DesignDesigned to get full usage of a languageDesigned to make coding fast and simple
ConversionConverts the whole program into machine language in one shotConverts high level instructions into machine language
CreationCreates a .exe fileDoes not create a .exe file
CompilationNeeds to compile the programThere is no need to compile the program
CodingProgramming is making a full code of programScripts are just a piece of code
TemperamentHarder to code. Needs numerous lines of code for each functionEasier to code. Needs only a few short lines of code for each function
ComplexityAre complexAre easy to use and easy to write
Development TimeTakes longer to develop as more code needs to be written.Takes less time to code as it needs less coding.
SupportExplicit support of Data Types. Rich support for User Interface Design. Limited support for User Interface Design.Implicit support of Data Types. Rich support for Graphic Design.Limited or no support for Graphic Design
HostingDoes not require a host. Is self – executableRequires a host
CostIncreased maintenance costReduced maintenance cost
ExamplesC, C++, C#, Java, VC++, VB, Basic, COBOL, Pascal, etc.JavaScript, VB Script, Shell, Perl, Python, Ruby, Rexx, PHP, GameMonkey, Lua, etc.

Hope this matrix will help you Ankit Shukla

High Five1
1 Beer1
Show all replies

Yeah just FYI to anyone who is newer - this table could definitely cause some misunderstandings and confusion. For example, there are in fact large applications written in scripting languages and small applications written in C. Also, you can develop something from scratch in a scripting language.

Reply to this…

Whilst the answers so far have some interesting information, they're NOT pointing out the distinction I'm familiar with on the term.

See, scripting languages use SOURCE distribution. Not all interpreters do. UCSD Pascal, most ROM BASIC's and so forth are interpreted, BUT they are NOT scripting languages because their distribution model is the intermediate bytecode, NOT the raw source. Whilst ROM BASIC tricks users into THINKING it's source distribution -- it is not. When you enter a line of code it is turned into bytecode, when you "list' the program it is reverse engineered back into legible code.

PHP, JavaScript, shell scripts, and so forth when you deploy your code what you are deploying is the raw flat-text source code.

That's the distinction as I've understood it.

Clap1
Show all replies

M - CORRECT! There's no reason you couldn't make a C interpreter (hell that's damned near what PHP and JavaScript are) or a compiler for JavaScript.

Hell, that's where "Just in time" compilation has really started to blur the lines. Hence the whole "virtual machine" bullshit assigned to Java that was more marketing asshattery than fact, since it's JUST a P-Code interpreter with JIT compilation and a really big system library.

Meaning Java is about as bleeding edge in methodology as a really good UCSD Pascal implementation.

Take BASIC which spent the first two decades of its life as a interpreted language, but eventually it started getting compilers.

So yeah, it's not so much a thing specifically tied to the programming language itself any more than compiled or interpreted is. Spot on assessment!

Reply to this…

A "scripting language" is a subcategory of "programming languages", which generally refers to interpreted languages, as opposed to compiled languages. A compiled language is something which you compile to machine readable code, which is either straight up assembly code, or byte code, which has a closer correspondence to machine code, thus making it easier for the virtual machine to optimize either during compilation or during run time using a JIT (Just In Time) compiler.

Spot On1
Show all replies

Yeah I must have misread it too... I thought he was asking about difference between compiled language and interpreted. Did he change it after the fact or are we all just nuts? lol

Reply to this…

In addition to other answers, "scripting language" often has the connotation of being a lightweight tool for automating a task quickly. Usually only the command line or a text editor is necessary to write a script; no compiler. Scripts may often only be a few lines long, such as a basic sed or awk script for transforming a text file. They often don't require a long list of imports. They are almost always loosely typed. The language will often provide simplified ways of completing common procedures, such as reading and writing to files, performing regex matching, or making a HTTP request. They can also be used as gluecode for automating tasks written in different languages.

Now, given that explanation, don't go thinking that scripting languages are any less capable than "programming" languages. Scripting languages can be used to write applications that are just as sophisticated and complex as compiled languages, often times in much less time.