Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a formal programming language?

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.

like image 771
Orjanp Avatar asked Apr 19 '10 16:04

Orjanp


People also ask

What do you mean by formal language?

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.

What is formal language example?

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]

Is Python a formal language?

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.

What are the types of formal language?

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.


2 Answers

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.

like image 59
zoul Avatar answered Sep 22 '22 05:09

zoul


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.

like image 42
mkorpela Avatar answered Sep 18 '22 05:09

mkorpela