Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is a new programming language actually formed/created?

Fortran->Algol->Cpl->Bcpl->C->C++->Java .....

Seems like every language is built upon an ancestor language. My question : New languages extend parent ones or there is some kind of a trick?

e.g. System.out.print() in Java ; is it actually printf() in C, and so on (printf is actually .. in Cpl)?

If so, doesn't this make every further language be slower and need more memory? What separates a new language from a framework?

like image 435
Horatiu Jeflea Avatar asked Apr 29 '10 23:04

Horatiu Jeflea


People also ask

How are new programming languages created?

Just write down some instructions and some rules for what they do, and voila, you've created a programming language. If you write down these rules using slightly fancy language, you would call that the specification of your language and have a very good claim to have created a programming language.

Why New programming languages are created?

There are several reasons for creating a new language: You see deficiencies and what to create a language that is easier to use, or more robust. The domain you're working in could benefit from having it's own language (domain specific languages) You want to challenge yourself or test a theory in language design.


3 Answers

How is a new programming language actually formed/created ?

It's a multistage process:

  1. Pointy-headed type theorists and other professionals are continually proposing new language features. You can read about them in places like the Proceedings of the ACM Symposium on Principles of Programming Languages (POPL), which has been held annually since 1973.

  2. Many of these proposals are actually implemented in some research language; some research languages I personally find promising include Coq and Agda. Haskell is a former research language that made it big. A research language that gets 10 users is often considered a success by its designers. Many research languages never get that far.

    From research to deployment I know of two models:

  3. Model A: A talented amateur comes along and synthesizes a whole bunch of existing features, maybe including some new ideas, into a new language. The amateur has talent, charisma, and maybe a killer app. Thus C, Perl, Python, Ruby, and Tcl are born.

  4. Model P: A talented professional make career sacrifices in order to build and promulgate a new language. The professional has talent, a deep knowledge of the field, and maybe a killer app. Thus Haskell, Lua, ML, Pascal, Scala, and Scheme are born.

    You propose another model:

  5. Model E: A talented person, whether amateur or professional, extends or modifies another language. There's a built-in user base who may be interested in the extension. Maybe users can explore new ideas without paying heavy transition costs. Thus C# and C++ are born.

My definition of a professional is someone who is paid to know about programming languages, to pass on that knowledge, and to develop new knowledge in programming languages. Unfortunately this is not the same as designing and implementing new languages, and it is not the same as making implementations that many people can use. This is why most successful programming languages are designed and built by amateurs, not professionals.

There have been quite a few interesting research languages that have had hundreds or even thousands of users but yet never quite made it big. Of these one of my favorites is probably Icon. I have argued elsewhere that nobody really knows why languages become popular.

Do new languages extend parent ones?

This is actually very rare. C++ is the most popular example, and perhaps Algol-W or PL/S came close. But it's much more common to use the parent language for inspiration only, and some languages (Python comes to mind) acknowledge multiple "parents" as sources of inspiration.

Doesn't this make every further language be slower and need more memory?

Not necessarily. C++ is slower and uses more memory not because it is descended from C but because it was developed by accretion over time to the point where only a very skilled user can reliably write C++ code that is as fast as similar C code. (I want to be very clear: it's not that C++ can't be fast; it's that the cost of C code is always obvious from reading the source, and the cost of C++ code is sometimes not at all obvious from reading the source.) For more information about the evolution of C++, read Jim Waldo's book The Evolution of C++.

Java was initially slow because of just-in-time compilation and other wacky things in the implementation. They also saddled themselves with this dynamic class-loading stuff which is really hard to get things to be fast (because a class could be extended dynamically at any moment). Kenny Zadeck, Roger Hoover, and David Chase built a really fast native-code compiler for Java without dynamic class loading.

For a counterexample, I think Scheme programs ran faster and used less memory than the Lisp programs that preceded them—in part because Guy Steele is both a brilliant designer and a brilliant implementor. (Rare combination, that.)

But there is something to what you say: people who lack the expertise to build a good compiler from scratch or who lack the expertise to design a whole language from scratch may well hack up an implementation of something not too different from a parent. In such cases one is quite likely to wind up with a language that is less well designed, less well implemented, slower, and using more memory than its predecessor. (Tony Hoare famously said that Algol 60 was an improvement on most of its successors [sic]).

It's also true that the more recently a language is designed, the more computing resources are available for the same price. Early C compilers had to operate effectively in as little as 128K of RAM. Today's C++ compilers face no such constraints, and there is every reason for them to use more memory: it is really cheap to populate a machine with gigabytes of RAM, and to limit ones use to mere megabytes saves nothing; the larger memory is already paid for.

Summary: Languages come into being because people want to make programming better, and they have new ideas. Languages get their start when somebody takes a whole bunch of ideas, some new and some proven, and synthesizes them into a coherent whole. It's a big job. One way to make the job easier is to draw not just on proven features, but proven designs, of one or more predecessor languages. This kind of design creates the impression of "parenthood", but actual extension or near-extension (in the case of C++ extending C) is rare. Time and space costs don't necessarily get larger as languages evolve, but it's often the case that people create languages by making existing designs more complex, and the more complex the design, the harder it is to implement efficiently. It's therefore not unusual that programs written in a new language seem slower or to use more memory than similar programs written in an ancestor language. Finally, as with all other forms of software, compilers designed and built recently tend to use more RAM and CPU than compilers built ten years ago, simply because large quantities of RAM and CPU cycles are available at bargain-basement prices.

like image 187
Norman Ramsey Avatar answered Dec 08 '22 09:12

Norman Ramsey


Languages are not slow, Implementations [created by compilers to assembly] are slow. In theory, you could have a C++ interpreter that ran slower than a PHP compiler or whatever. Languages also do not consume memory, implementations consume memory.

A project is a language when the grammar (or syntax) is different. (You could have both a language and framework in the same project)

Languages are formed just by the general creative process. Someone sees something kinda cool and thinks it could be better so they make it that way and eventually you get an entirely different language.

like image 20
Earlz Avatar answered Dec 08 '22 10:12

Earlz


There is a big difference, which may not be obvious, between saying that a language is built on the concepts of a predecessor and actually being built with it. C compiles into ASM so it is built on it but not necissarily with it. Often times (most?) C compilers are actually written in C. C++ is built on C, it supports the full spectrum of C and adds a bunch of stuff to it. Java is a totally different thing, likewise with .NET. They "compile" to a pseudo ASM referred to as IL for .NET and ByteCode for Java. Both require some other step or VM (virtual machine) to run.

like image 21
John Avatar answered Dec 08 '22 09:12

John