What makes a language a scripting language? I've heard some people say "when it gets interpreted instead of compiled". That would make PHP (for example) a scripting language. Is that the only criterion? Or are there other criteria?
What makes a language a scripting language? I've heard some people say "when it gets interpreted instead of compiled". That would make PHP (for example) a scripting language. Is that the only criterion? Or are there other criteria?
Simple. When I use it, it's a modern dynamic language, when you use it, it's merely a scripting language!
A scripting language is a language that "scripts" other things to do stuff. The primary focus isn't primarily building your own apps so much as getting an existing app to act the way you want, e.g. JavaScript for browsers, VBA for MS Office.
My definition would be a language that is typically distributed as source rather than as a binary.
"Scripting language" is one of those fuzzy concepts which can mean many things. Usually it refers to the fact that there exists a one step process taking you from the source code to execution.
For example in Perl you do: perl my_source.pl
Given the above criteria PHP is a scripting language (even though you can have a "compilation" process for example when using the Zend Encoder to "protect" the source code).
PS. Often (but not always) scripting languages are interpreted. Also often (but again, not always) scripting languages are dynamically typed.
I think Mr Roberto Ierusalimschy has a very good answer or the question in 'Programming in Lua':
However, the distinguishing feature of interpreted languages is not that they are not compiled, but that any compiler is part of the language runtime and that, therefore, it is possible (and easy) to execute code generated on the fly
I see a scripting language as anything not requiring an overt heavy-weight feeling 'compile' step. The main feature from a programmers standpoint is: you edit code and run it right away.
Thus I would regard JavaScript and PHP as scripting languages, whereas ActionScript 3/Flex is not really.
May I suggest that scripting languages has been a term lots of people are moving away from. I'd say it mostly boils down to compiled languages and dynamic languages nowadays.
I mean you can't really say something like Python, or Ruby are "scripting" languages in this day and age (you even have stuff like IronPython and JIT-your-favorite-language, the difference has been blurred even more).
To be honest, personally I don't feel PHP is a scripting language anymore. I wouldn't expect people to like categorize PHP differently from say Java on their resume.
A scripting language is a language that is interpreted every time the script is run, it implies having a interpreter and most are very human readable, to be useful a scripting language is easy to learn and use.
Every compilable language can be made into a script language and vice versa it all depends on implementing a interpreter or a compiler, as an example C++ has an interpreter so it can be called a script language if used so (not very practical in general as C++ is a very complex language), one of the most useful script languages at present is Python...
So to answer your question the definition is on the use of a interpreter to run quick and easy scripted programs, to address simple tasks or prototype applications the most powerful use one can make of script languages is to include the possibility for every use to extend a compiled application.
I prefer that people not use the term "scripting language" as I think that it diminishes the effort. Take a language like Perl, often called "scripting language".
Why do we even need to distinguish between a language like Java that is compiled and Ruby that isn't? What's the value in labeling?
For more on this, see http://xoa.petdance.com/Stop_saying_script.
Scripting languages tend to run within a scripting engine which is part of a larger application. For example, JavaScript runs inside your browsers scripting engine.
I would say scripting language is the one heavily manipulating entities it doesn't itself define. For instance, JavaScript manipulates DOM objects provided by the browser, PHP operates enormous library of C-based functions, and so on. Of course not a precise definition, more a way to think if it.
Your criteria sounds about right, but is always a bit fuzzy. For instance, Java is both compiled (to bytecode) and then interpreted (by the JVM). Yet it is normally not categorized as a scripting language.
This might be because Java is statically typed. Whereas JavaScript, Ruby, Python, Perl, etc. are not (all of which are often called scripting languages).
If it doesn't/wouldn't run on the CPU, it's a script to me. If an interpreter needs to run on the CPU below the program, then it's a script and a scripting language.
No reason to make it any more complicated than this?
Of course, in most (99%) of cases, it's clear whether a language is a scripting language. But consider that a VM can emulate the x86 instruction set, for example. Wouldn't this make the x86 bytecode a scripting language when run on a VM? What if someone was to write a compiler that would turn perl code into a native executable? In this case, I wouldn't know what to call the language itself anymore. It'd be the output that would matter, not the language.
Then again, I'm not aware of anything like this having been done, so for now I'm still comfortable calling interpreted languages scripting languages.
A script is a relatively small program. A system is a relatively large program, or a collection of relatively large programs.
Some programming languages are designed with features that the language designer and the programming community consider to be useful when writing relatively small programs. These programming languages are known as scripting languages, e.g. PHP.
Similarly, other programming languages are designed with features that the language designer and the programming community consider to be useful when writing relatively large programs. These programming languages are known as systems languages, e.g. Java.
Now, small and large programs can be written in any language. A small Java program is a script. For example, a Java "Hello World" program is a script, not a system. A large program, or collection of programs, written in PHP is a system. For example, Facebook, written in PHP, is a system, not a script.
Considering a single language feature as a "litmus test" for deciding whether the language is best suited for scripting or systems programming is questionable. For example, scripts may be compiled to byte code or machine code, or they may be executed by direct abstract syntax tree (AST) interpretation.
So, a language is a scripting language if it is typically used to write scripts. A scripting language might be used to write systems, but such applications are likely to be considered dubious.
Paraphrasing Robert Sebesta in Concepts of Programming Languages:
A scripting language is used by putting a list of commands, called a script, in a file to be executed. The first of these languages, named sh (for shell), began as a small collection of commands that were interpreted as calls to system sub-programs that performed utility funcions, such as file management and simple file filtering. To this basis were added variables, control flow statemens, functions, and various other capabilities, and the result is a complete programming language.
And then you have examples like AWK, Tcl/Tk, Perl (which says that initially was a combination between sh and AWK, but it became so powerful that he considers it an "odd but full-fledged programming language"). Other examples include CGI and JavaScript.