how can explain the diference between programming languge and protocol?,
can protocol have extension?
we know that machines communicate with protocol, but they can also do so with expressive language.
so, I think the difference between these two is unclear. also, the references for defining these two are not clear.
so maybe protocol is superset of language, eg:
protocol equ communication language?,
assembly equ machine language?,
css equ styling language?,
can any body do explain what is a protocol compared to language?
1
Technically, a formal language (programming languages are a subset of those) is a set of strings that are valid in that language. For a language to be useful, it also has to have semantics, i.e. what does a string in the language mean.
For example, print('hello')
is a valid string in the language Python and { "name": "zukerman" }
is a valid string in the language JSON.
On the other hand, a protocol describes how machines communicate with each other using messages. A protocol can define what messages can be sent when, what are the roles of the machines (e.g. client and server), etc. A protocol also defines the format of messages, which is a language, though it’s not commonly called that.
For example, you can’t really say that GET /index.html HTTP/1.0
is a valid string in the protocol HTTP, even though it’s a valid HTTP client request.
If you’re asking specifically about programming languages, then those are languages whose semantics describes computations. Protocols in general don’t do that, though some specific protocols do, e.g. RPC protocols.
6
The distinction is a matter of degree.
Consider the security procedures at a major bank. Every morning the first employe to appear moves a certain potted plant to a subtly different location to signal all other employees “It’s okay, there is NOT a criminal gang lurking in the back office trying to kidnap the first two employees to show up and to get them to open the four-eyes safe” (or so I’ve read in thriller novels). When the second employee arrives and the plant has not been moved, they know to call the police immediately.
This is a protocol. It uses well-specified signals to express well-specified meanings, but rather few of them (only two different meanings).
Now compare this to the use of the English language between two employees to coordinate their work, or to chat about their personal lives. This also uses signals to express meanings, but the spectrum of what can be said and understood is infinitely richer and more complicated.
That, in a nutshell, is the difference between a protocal and a language. Restricted languages, such as the one used by international airline pilots when communication with air traffic control, are closer to mere protocols than normal language is. Very complicated protocols, such as big programming languages, are nearer to being languages than very simple ones. Where to draw the line between the two, as always, is ultimately a matter of opinion.
1