Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relation between programming languages

I was wondering about the following questions:

  1. What does it mean "some language is a subset/superset of another"? Can it be defined in mathematics? Is it related to the subset/superset concept in elementary set theory?
  2. Are almost all existing languages implemented/written in some small number of low-level languages? For example, are most languages written in C? Is C++ written in C?

    Is there some relation between the implementation relation and the concept of subset/superset of languages?

  3. In terms of language features, some languages have more than some other. In some cases, some has all the features of some other, for example, does C++ have all the features of C?

    Is there some relation between the subset/superset relation in terms of the set of features and the subset/superset relation between languages?

  4. Are there other aspects that characterize relation between languages?

Thanks and regards!

like image 267
Tim Avatar asked Mar 25 '11 23:03

Tim


People also ask

What is the relationship between programming and language?

✨✨Yes there is always an relationship between programming language and how computer works, compiler operating system design of computers all made by using programming language like c, c++, vhdl, vlsi, matlab, every language written in some rules and grammar to interpret and make relationship with the platform like ...

Are all programming languages related?

Yes, programming languages are similar but not that much. The basics of every programming language are pretty much the same, but the way you write and use those basics to solve problems differs a lot for every language. Python and JavaScript are mostly used for the same things and code looks very similar.


1 Answers

What does it mean "some language is a subset/superset of another"?

Syntactically a language A is a subset of a language B if every program that is valid in language A is also valid in language B. Semantically it is a subset if it is a syntactic subset and each valid A program also exhibits the same behavior in language B.

Can it be defined in mathematics? Is it related to the subset/superset concept in elementary set theory?

Syntactic subset: If P_A is the set of all valid programs in language A and P_B is the set of all valid programs in language B, then language A is a syntactic subset of language B exactly if P_A is a subset of P_B.

Semantic subset: Let A(p) be a function which describes the behavior of program p in language A, and B(p) describe the behavior of program p in language B. A is a subset of B if and only if for all p for which A(p) is defined, B(p) is also defined and A(p) = B(p).

Are almost all existing languages implemented/written in some small number of low-level languages?

This depends on your definition of "almost all" of course, but I'm inclined to say no. Many compilers and interpreters are written in C and C++ (simply because a lot of software in general is implemented in C and C++), but by far not all.

For example, are most languages written in C? Is C++ written in C?

As has been pointed out in comments already, C++ is a language not a piece of software. g++ which is the GNU C++ compiler is written in C, but there are also C++ compilers which are written in different languages (probably).

In terms of language features, some languages have more than some other. In some cases, some has all the features of some other, for example, does C++ have all the features of C?

Yes (unless you count simplicity as a feature).

Is there some relation between the subset/superset relation in terms of the set of features and the subset/superset relation between languages?

If a language is a superset of another language, the set of that language's features will also have to be a superset of the other language's features (again unless you count simplicity or things like "the language does not allow X" as a feature).

This is not applicable in the other direction however (i.e. just because A's features are a superset of B's features, A does not have to be a superset of B).

like image 167
sepp2k Avatar answered Sep 20 '22 01:09

sepp2k