How is a programming language developed?

Asked

Viewed 9,859 times

40

How a programming language is created?

In general terms, where and how the validation of the functionalities of the new language works?

For example, we have the C++ language, it is complex and has a lot of content and use, but how did it get here? How did it start, how was it created? I’m only using C++ as an example, the question is more general.

I don’t care what a programming language is that already has questions about this. I don’t care about how a compiler works and its difference to language, this has been asked before.

  • 5

    You can start around here.

  • 5
  • 3

    Could you explain what "function validation" is? A new language usually arises from the dissatisfaction of the programmers with the current ones, anyone can create a new language from a person to a company, the addition/removal of functionalities can (usually) be done by a Comite who votes (for or against) in those updates/specifications.

  • 1

    the question has not been duplicated, has no relation, even has, but I am not asking what it is but how it is.

  • I don’t know if I understood the main point of your question. You don’t want to know anything specific about C++, but generic? Is your intention to know the history of the programming languages and why the decisions that have been taken (whatever) have been taken? It’s confusing, and I tend to vote as not clear. But even if it is, there it is only too broad.

  • 2

    @Victorgomes I edited the question to try to make it more appropriate and clear based on what I understood. See if I haven’t changed your original intention. You can change if you think it’s bad, or you can say something you think is bad.

  • 2

    The question is simple, as is the process, how the development of a language works, I do not want anything complex, just a doubt that has a vague content on the Internet. Summary summary is how a language is created, it has to have a right start? How it starts. (When I say it, I mean any programming language, without specifying or referencing any, in general, how a programming language is created) Well, I hope it helped to understand and it’s a shame they’re giving down vote and 1 vote to close the question.

  • 1

    This question is being discussed at the finish line: Question closed but still open?

  • 3

    @Jorgeb. Actually, no :) Is being discussed a bug or something like that, the question is clear that it is not duplicated and nor does it seem to me to be broad, which is not under discussion there.

Show 4 more comments

1 answer

42


The beginning

It’s like making any software.

A new language arises from the need to solve some kind of specific or general problem differently than before. This was the case when the first low-level languages were created (several Assemblies) and then with Fortran - considered the first high-level language - and then languages that were using or adding new paradigms and styles of code, meeting needs that were not previously covered by previous languages.

Of course it is possible to create a language without innovating, without meeting an unmet need. One can create only as an exercise or other reason.

Creating a programming language is to put together a lot of ideas and rules and formalize everything to a greater or lesser degree. A language is something conceptual, is abstract.

Philosophy

Obviously during the creation of the language has a number of decisions that must be made that go beyond grammar or that will influence grammar (see below on what it is). For example:

  • that paradigm(s) the language will adopt
  • typing model and memory management
  • implementation efficiency criteria and translation of the code
  • usability, simplicity, readability, maintainability
  • reliability, accuracy, robustness - what is prohibited (error), allowed (alert) and regular
  • universality, portability, form of execution
  • expressiveness, style of syntax
  • extensibility
  • generality (or the specific niche)
  • orthogonality, uniformity, regularity, consistency
  • ease of implementation and environment
  • how to deal with specific situations (error handling, easy integration of tools such as debug or IDE, for example)

Even some unusual things can be decided and/or specified. Others, it is better to leave open, language need not require everything to be specified and let the implementation have a certain freedom.

Therefore, before beginning to specify grammar, it is customary to define a "vision", a philosophy for language. There are few items that will guide decisions, especially when there are conflicts between a decision and another.

Think that you are creating a product, or even a company. You need to have a "north" to know where you want to go, what the expected result is, what you can or cannot do when an obstacle or an opportunity arises. What are the "values" of language. Python has it formally, C++ as well (probably the most well defined, and followed since it exists, of all languages).

Of course, if it is too general, in the background it fits something. And if it is not to follow, better not do. If you do it and are too rigid, the language will certainly be bad.

Grammar

As it is a language she needs a grammar. That is, you need a set of rules to use words (including how they are written). It is common that these rules are written in BNF or some variation of this notation (interestingly BNF is still a language). A example of the language C. Grammar of Javascript. There is a question in the OS with several others.

Those rules are syntactic and semantics.

There are some software that helps you assemble your grammar, test it if it all fits as due, and even generate a source base for the compiler. Examples: YACC/Bison, ANTLR, GOLD, Coco/R, Flex, etc. They don’t do miracles. If you don’t use such software, you have to do it by hand, as in everything in computing. Testing without help is tedious and error-inducing in the process.

During the creation of grammar it is likely to change a lot of things that one had initial idea. Some things don’t work well with others as you might initially imagine. It depends on orthogonality.

I always see questions about why a language doesn’t allow this or that. If you’re a layman, you think you’ve created language in the wrong way. Often there is a difficulty having everything in the same language, the characteristics do not fit. Others just do not fit the goal drawn. And others are errors :). Those who are not programmers can not even think about this question.

And then?

Some rules, besides grammar, of how the language implementation can be specified and there whole compiler/interpreter must follow them.

After defining the language, usually comes the definition of a standard library that every implementation should have.

With the specified language, it is possible write a compiler for her. It’s the language implementation. Here it begins to become concrete.

Obviously other tools to help you may be useful, but not mandatory.

General-purpose language creators love to rewrite the compiler itself as soon as possible, it even serves as marketing, this is called Bootstrapping.

Testing

Specification makes it easy to use TDD (never seen :D). A compiler is a project that this methodology goes very well, but not mandatory. At least unit tests should be done. Tests should always match the specification. In some cases where the specification is not formalized, the tests serve as specification.

Additional information

C++

C++ is an evolution of C. Basically every language is an evolution of others. It always aggregates or removes characteristics to have a set of "functions" more suitable for a given objective. It was defined by a person at AT&T, the same place where the C language was created to write Unix.

Its goal was to provide more security and be an object-oriented version of C. Bjarne was thinking about what he needed to add, using a little Simulates as a basis of ideas, specified and analyzed if things fit, if something could bring problems.

There is a basic philosophy for language evolution. Grammar of the C++.

  • 1

    Great that at least 1 person managed to understand the question, great explanation and a very well elaborated summary, interesting content, I will definitely study about.

  • 1

    @mustache example of language C...

  • 1

    @Jorgeb. I asked other people to access and it’s ok.

  • 1

    @bigown "An error occurred During a Connection to Cs.wmich.edu. SSL Received a record that exceeded the Maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG"

  • 3

    Or it happens by accident as in the case of PHP. :P

Browser other questions tagged

You are not signed in. Login or sign up in order to post.