What defines a programming language? - programming-languages

Recently I've starting a project I'm calling 'JIL' or JIL Interfacing Language, and it's to be a programming language of sorts. Now, I doubt it will ever be super-useful or versatile, but the aim of it is to be a step up from block programming, but a step down from complex languages like java, C, or C++. JIL stands for JIL Interfacing Language because it is both interpreted and parsed in java, and all of its keywords/methods will be interpreted and then executed in java. My question is would JIL count as a 'true' programming language, or is it a 'false' or 'secondary' programming language that is nothing more than a java application.

using wiki's definition as a rule of the thumb:
A programming language is a formal constructed language designed to
communicate instructions to a machine
yours is formal because it can be parsed. if it also instructs machine what to do then congratulations - your first programming language :)

Related

Relationships beetween Complied/Interpreted/Scripting and other programming language classifications?

I got lost in the classifications of programming languages. What is the relationships between "Compiled/Interpreted/Scripting" and "OOP/Procedural/Functional", and possibly many "terms" for classifying languages?
I do not even know how to ask this properly. Looked for programming language hierarchy but every diagram is always missing some terms above.
There is not really a relationship between them, as they are different classification systems.
OOP/Procedural/Functional describe the syntax and grammar of a programming language.
It describes what a language looks like to the software programmer.
Compiled/Interpreted/Scripting describes how the language is processed, and what is necessary for a program to run.
Compiled languages are transformed into machine code before execution, interpreted and scripting languages are transformed into machine code during execution.
Examples of languages and their classification in either system:
Java is a OOP Compiled language.
Kotlin is a functional compiled language.
Python is a procedural interpreted language.
Javascript is a functional scripting language

Is there any programming language that is defined by reference implementation?

Some of the major programming languages (see list below) are defined by a specification. But in principle, you could also define a language by implementing a reference compiler / interpreter. (I don't want to say that this would be a good idea.) But I'm curious:
Is there any (major) language that is not defined by specification, but by reference implementation?
By major language I just want to make sure that answers don't come up with esoteric ones (Whitespace, Brainfuck, ...) or with something like "I've created this compiler a while ago. There is not specification, so your answer is 'yes'."
List of programming language specifications
C: At least 3 specifications. ISO 9899:2011 is the latest one.
C++: e.g. this
Java: Java language Specification
JavaScript: ECMAScript Language Specification
Perl: Perl 6 specification
PHP: PHP language reference
Python: Python language reference
I was not able to find a specification for Ruby and TCL
Almost all programming languages are defined by a reference implementation, until they're not. Every language I can think of with just a couple of important exceptions started with a reference implementation and a loose specification. Over time, as it matured, the specification was hardened and the compiler was required to follow its own spec.
The major change occurs when there is a second implementation. Then you need a formal spec (but you don't always get one).
Early exceptions include Algol 60, Pascal and Ada. Each of those acquired a spec very early on, and then often multiple implementations. C# is another.
In answer to your question, Delphi is now the reference implementation for its own brand of Pascal; FoxPro is the only dBase language left; Rebol; Basic (any dialect you choose); SQL (most dialects are non standard); R and S; etc.
The list of programming languages is vast, the list of standards is quite small. I rather guess your question is definitional: how many languages will you accept as 'major'?

what are scripting languages? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
When is a language considered a scripting language?
What languages are scripting languages?? Couldn't we write scripting languages as a stand alone??
A scripting language, script language
or extension language is a programming
language that allows control of one or
more software applications. "Scripts"
are distinct from the core code of the
application, as they are usually
written in a different language and
are often created or at least modified
by the end-user. Scripts are often
interpreted from source code or
bytecode, whereas application software
is typically first compiled to a
native machine code or to an
intermediate code.
Source
There is PHP, Perl, Python, Ruby, etc. More HERE.
Scripts are ran by an interpreter, so there must be an interpreter in the Operating System for the script to run.
In my opinion a scripting language is a language that is interpreted rather than compiled.

How can a programming language be "implemented"?

maybe this is just a little misunderstanding but how can a programming language be implemented?
I'm not talking about how to implement my own programming language but about the word "implemented"?
I mean, you can implement a compiler or an interpreter, but a programming language?
What does it mean if I read "C++ is implemented in C" or "Python was implemented in C"?
I think a language is more sth. like a protocol of how someone thinks about things should be implemented. For example, if he wants do display a messagebox he can say the command for this is ShowMessageBox(string) and implement a compiler who will translate this into something that works on a computer (aside from the selected programming paradigms he imagines).
I think this question leads to the question "what is a programming language in reality"? A compiler, an interpreter or just a documented language standard about how things should be implemented in a language?
[EDIT]
Answer: Languages are never implemented, only compilers/interpreters etc. It's this simple.
Here's a very academic answer (from a longtime academic).
First I'll reframe the question:
What does it mean for a programming language to be implemented?
I'll start with "what is a programming language":
A programming language is a formal language (a set of utterances we can characterize precisely through algorithmic rules) such that a sentence in the language has a computational meaning. There are a variety of ways to give computation meaning; two of the most popular are that a computation stands for a function (from values to values, or from machine states to machine states) and that a computation stands for a machine that makes "state transitions" and interacts with the outside world.
A language is implemented when a means is provided to read in an utterance and perform the computation, that is, calculate the function or perform the behavior. The means is the implementation.
Typical implementations include
Direct interpretation of the language syntax. This model is rare but FORTH probably comes closest to it.
Translation of the syntax into virtual-machine code, also called bytecode, which is itself another language and which is interpreted. It is popular to write bytecode interpreters in C. Lua, Perl, Python, and Ruby are implemented more or less this way.
Translation of the syntax into hardware machine instructions, which is itself another language, and which is interpreted by your CPU. C and C++ are typically (but not always) implemented this way.
Direct interpretation of the language in hardware. IA-32 machine code and AMD64 machine code are implemented this way.
When a person says "Language X is implemented in Y", they are usually saying that a translator for X or an interpreter for X's bytecode is written in language Y.
One of the great secrets of compiler writers is the ability to write the compiler for language X in language X itself. If this interests you, get Andrew Appel's paper Axiomatic Bootstrapping: A Guide for Compiler Hackers.
Sometimes the answer to this question is not obvious. Squeak Smalltalk writes both a translator and a bytecode interpreter in Smalltalk, then translates the interpreter to C, which is translated to machine code. What is Squeak implemented in? Smalltalk.
Poke a professor; get a lecture.
You are right, those statements don't make any sense. It's pretty obvious that whoever made those statements doesn't understand the difference between a programming language and a compiler (or interpreter).
This is a surprisingly common problem. For example, sometimes people talk about interpreted languages or compiled languages. That's the same thing: languages aren't interpreted or compiled, they just are. Interpretation and compilation are traits of the implementation not the language.
Another goodie: Python has a GIL. No, it doesn't: one implementation of Python has a GIL, all the other implementations don't, and the Python Language itself certainly doesn't. Or: Ruby has green threads. Again, not true: Ruby has threads. Period. Whether any particular language implementation chooses to implement them as green threads, native threads, platform threads or whatever, is a trait of that particular implementation, not of Ruby. And of course my favorite: Ruby 1.9 is faster than Ruby 1.8. This doesn't even make sense: Ruby 1.9 and Ruby 1.8 are programming languages, i.e. a bunch of abstract mathematical rules. You cannot run a programming language, therefore a programming language can never be "faster" or "slower" than another one.
The most blatant confusion about the difference between programming languages and implementations is the Computer Language Benchmark Game, which claims to benchmark languages against each other but in fact benchmarks implementations.
All of these are just different expressions of the fact that apparently some people seem to be fundamentally incapable of grasping the concept of abstraction. Or at least the concept of having an abstract language and a concrete implementation of that language.
If we go back to the statement that "Python is implemented in C", it should now be obvious that that statement is not just wrong. If the statement were wrong that would imply that the statement even makes sense, i.e. that there is some possible world out there, in which it could at least theoretically be right. But that's not the case. The statement is neither wrong nor right, it simply doesn't make sense. If English were a typed language, it would be a type error.
Python is a programming language. Programming languages aren't implemented in anything. They are just implemented. Compilers and interpreters are implemented in languages. But even if you interpret the statement this way, it isn't true: Jython is implemented in Java, IronPython is implemented in C#, PyPy is implemented in RPython and Python, Pynie is implemented in PGE, NQP and PIR. (Oh, and all of those implementations have compilers, so there goes your "Python is an interpreted language".) Similar with Ruby: Rubinius is implemented in Ruby and C++, JRuby and XRuby are implemented in Java, IronRuby and Ruby.NET are implemented in C#, HotRuby is implemented in ECMAScript, Red Sun is implemented in ActionScript, RubyGoLightly is implemented in Go, Cardinal is implemented in PGE, NQP and PIR, SmallRuby is implemented in Smalltalk/X, MagLev is implemented in GemStone Smalltalk and Ruby, YARI is implemented in Io. And for C++: Clang (which is the C, C++ and Objective-C front-end for LLVM) is implemented in C++ (all three front-ends are implemented in C++).
"C++ is implemented in C". I understand this as "C++ compiler is written in C language". Quite simple, without too much philosophy.
Generally, C++ compiler can be written in any language, including C++ itself (except of the first compiler version).
"Python was implemented in C" means that at least one Python compiler (in this case the most commonly used one) is written using C. The developers of that implementation of Python made a deliberate decision not to use C++. As a statement it is incomplete as Python has also been implemented in Java, in C# and in Python.
The main relevance is that it gives you some idea of the systems you might be able to port the language onto: anything targeted by a C compiler should (at least in theory) be capable of running the C implementation of Python, but if they'd chosen to use C++ there would be a smaller set of systems that could run it.
C++ usually isn't implemented in C these days: I believe it is usually implemented in C++. It is quite common for languages to be implemented in the same language (or a subset of the language) as it means you are no longer dependent on some other unrelated language being available for the target. To bootstrap onto a new system you cross compile from some other system.
If you compile gcc for a new platform the build process involves compiling the source code once with whatever compiler is already available (perhaps an older gcc), then compiling it a second time with the newly compiled compiler, then compiling it a third time with the output from the second compilation. If the second and third versions aren't identical you get a build error. If they are identical then you've got a pretty good indication that it compiled correctly.
A programming language is a standard. Its interpreter or compiler is an implementation of this standard.
To build a new language, you don't necessarily needs to do in in low level machine code (assembly for instance). So, using another language to accomplish your goal (creating a new language here) is perfectly normal. So, when we say: Python was implemented in C, it just means that C was used to create that language. For instance, C can be complied on many different architecture, so the programmers doesn't have to take care of the different type of computers (portable).
A language is just a way to express yourself to the computer. Today, it can be done in various ways. But when you use the same syntax as the language and create your own framework, it's called a library or framework. A programming language is just a notation for writing program. If the notation change, you have a different language. Like French or Spanish comes from Latin. (French is implemented in Latin ;)
Why is there so many different languages? Because the goal of a language is to solve complex problems. So, depending on what you want to try yo accomplish, choosing the appropriate language can be an important decision.
The statement "Language X is implemented in Language Y" makes sense and is true if and only if there exists a canonical implementation of Language X and that implementation is written in Language Y. In common usage, either the first or the most popular implementation is often assumed to be canonical.
For example, Perl is one of the few languages with a definitive canon. "Python is implemented in C" makes sense if CPython is taken to be the canonical implementation of Python, and "C++ is implemented in C" is true for CFront, the original implementation of "C with classes" by Bjarne Stroustrup.
The direct answer:
Implementation in the context you are talking about just means written and language actually means compiler.
The original C++ compiler was as I understand it written in C. There is nothing (apart from knowledge and time) to stop you from writing a C++ compiler in another language.
Implementation is the code that makes software work. Often we talk about the implementation of a function as in: "the function has not been implemented yet."
eg
void foo()
{
//function has not been implemented yet
throw();
}
This often happens during the design phase of a program because the call needs to be there in order to write/debug/concept test the calling code but we haven't got round to implementing (writing the code to go insde the function)

What strongly typed languages should I consider for my next development language?

I'm currently assessing which strongly-typed server-side languages I could choose to learn next. I'm coming from a background of mainly php development (oop). I'm looking at strongly-typed languages as I consider this a major downside to php (and sometimes an upside).
I know both C# and Java (JSP/Servlets) are an option, however I wanted to consider other languages that I've yet to research.
I'm mainly looking at this from a career POV, so theres no point in picking up a language that's dying out or in low demand (now or in the future).
Scala very beautifully blends object oriented programming and functional programming to form a new programming paradigm called object-functional programming which is, as far as my experience goes, most scalable and productive paradigm ever.
Go for it, I would say.
Do you mean statically typed languages (checked at compile time)? If so, C# or Java really are probably your best bets for widely used server-side languages. Languages such as Python and Ruby are strongly typed, but they are dynamic like PHP.
http://en.wikipedia.org/wiki/Type_system
http://en.wikipedia.org/wiki/Strongly_typed_programming_language
First avoid using "strongly typed " most people misunderstood this term. (I personally refuse to give it a meaning)
I am assuming that your are talking of a statically type language as opposed to a dynamically type language.
I can understand from your background with php that you want to lean a statically type language but be aware that php is the worst dynamically type language that I have ever seen.
I would say that if you know C#, Java that is enough.
IMHO learning a language for a career POV is not what will improve your skill in PL.
This because most industries have no idea which language to choose in other to express the best there problems. So there are choosing language base on what the other competitors used. [1]
Your also have to ask your self why you want to learn statically type language.
Understand what is the difference between static and dynamic typing and what it implies. This is a hard question to answer. Is not as obvious as what most people think.
So I can answer which language while improve your programming skill ( LISP (DT) , Smalltalk (DT) , Scheme (DT) , ML (ST) , Haskell (ST), Prolog (DT), C (ST), Self (DT) ).
DT: Dynamically type,
ST: Statically type
[1] http://www.paulgraham.com/avg.html

Resources