What does it mean that a programming language is a formal programming language? And which languages are formal programming languages? And which are informal programming languages?
I haven't found a good explanation yet.
A formal language is a language designed for use in specific situations, such as math or computer programming. A natural language is a language that has been developed naturally over time by its users. We use natural languages, such as English, Spanish, Hindi, and Japanese, to communicate with each other.
In formal language, grammar is more complex and sentences are generally longer. For example: We regret to inform you that the delivery will be delayed due to adverse weather conditions [formal] Sorry, but the delivery will be late because of the weather [informal]
A language (a set of strings) that can be described by a finite automaton is called a regular language. Formal languages are important to computer science (and to many other fields). All programming languages, like Java, C, and Python, are formal languages.
Formal language is characterized by the use of standard English, more complex sentence structures, infrequent use of personal pronouns, and lack of colloquial or slang terms. Informal language allows the use of nonstandard English forms, colloquial vocabulary and typically shorter sentence structures.
Every programming language is a formal language, so that it does not make much sense to me to speak of a “formal programming language.” (Or does somebody know an informal programming language?)
Formal language is a language with mathematically precise construction rules. Or, more precisely, it’s a set of words over some alphabet. For example, if you take alphabet consisting of the letters a
, b
and c
, a formal language over this alphabet could be a set {a
, aa
, aba
, ca
}. Of course such a language would not be very useful – the point is that with a decent set of construction rules you can create a language such as C or PostScript.
As for the “construction rules,” they could be a formal grammar (see grammar for CSS), a regular expression (see this gorgeous regex for e-mail addresses as defined by RFC 822), an automaton or a general algorithm.
If you feel you don’t understand the thing a tiny bit more, do not despair, for this is not a very good explanation :-) There’s a lot of thinking behind the concept of formal languages. I’d suggest that you try and digest the Wikipedia entry and look for more tutorials and books. It’s fun and you will learn a lot about the background of compilers, regular expressions, Turing machines and other wonders of digital mankind.
Formal means well defined. Every programming language that can be used to define executable programs has to be well defined so that machines can understand it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With