Pragmatics is a subfield of linguistics and semiotics that studies the ways in which context contributes to meaning. Pragmatics encompasses speech act theory, conversational implicature, talk in interaction and other approaches to language behavior in philosophy, sociology, linguistics and anthropology. Unlike semantics, which examines meaning that is conventional or "coded" in a given language, pragmatics studies how the transmission of meaning depends not only on structural and linguistic knowledge (grammar, lexicon, etc.) of the speaker and listener but also on the context of the utterance, any pre-existing knowledge about those involved, the inferred intent of the speaker, and other factors. In that respect, pragmatics explains how language users are able to overcome apparent ambiguity since meaning relies on the manner, place, time, etc. of an utterance.
The word pragmatics derives via Latin pragmaticus from the Greek (pragmatikos), meaning amongst others "fit for action", which comes from (pragma) "deed, act" (in modern Greek /pragma "an object,a thing that can be perceived by the senses"), in turn from the verb (prass?) "to do, to act, to pass over, to practise, to achieve."
Pragmatics was a reaction to structuralist linguistics as outlined by Ferdinand de Saussure. In many cases, it expanded upon his idea that language has an analyzable structure, composed of parts that can be defined in relation to others. Pragmatics first engaged only in synchronic study, as opposed to examining the historical development of language. However, it rejected the notion that all meaning comes from signs existing purely in the abstract space of langue. Meanwhile, historical pragmatics has also come into being. The field did not gain linguists' attention until the 1970s, when two different schools emerged: the Anglo-American pragmatic thought and the European continental pragmatic thought (also called the perspective view).
The sentence "You have a green light" is ambiguous. Without knowing the context, the identity of the speaker or the speaker's intent, it is difficult to infer the meaning with certainty. For example, it could mean:
Another example of an ambiguous sentence is, "I went to the bank." This is an example of lexical ambiguity, as the word bank can either be in reference to a place where money is kept, or the edge of a river. To understand what the speaker is truly saying, it is a matter of context, which is why it is pragmatically ambiguous as well. 
Similarly, the sentence "Sherlock saw the man with binoculars" could mean that Sherlock observed the man by using binoculars, or it could mean that Sherlock observed a man who was holding binoculars (syntactic ambiguity). The meaning of the sentence depends on an understanding of the context and the speaker's intent. As defined in linguistics, a sentence is an abstract entity: a string of words divorced from non-linguistic context, as opposed to an utterance, which is a concrete example of a speech act in a specific context. The more closely conscious subjects stick to common words, idioms, phrasings, and topics, the more easily others can surmise their meaning; the further they stray from common expressions and topics, the wider the variations in interpretations. That suggests that sentences do not have intrinsic meaning, that there is no meaning associated with a sentence or word, and that either can represent an idea only symbolically. The cat sat on the mat is a sentence in English. If someone were to say to someone else, "The cat sat on the mat," the act is itself an utterance. That implies that a sentence, term, expression or word cannot symbolically represent a single true meaning; such meaning is underspecified (which cat sat on which mat?) and potentially ambiguous. By contrast, the meaning of an utterance can be inferred through knowledge of both its linguistic and non-linguistic contexts (which may or may not be sufficient to resolve ambiguity). In mathematics, with Berry's paradox, there arises a similar systematic ambiguity with the word "definable".
This section does not cite any sources. (April 2009) (Learn how and when to remove this template message)
The referential uses of language are how signs are used to refer to certain items. A sign is the link or relationship between a signified and the signifier as defined by de Saussure and Huguenin. The signified is some entity or concept in the world. The signifier represents the signified. An example would be:
The relationship between the two gives the sign meaning. The relationship can be explained further by considering what we mean by "meaning." In pragmatics, there are two different types of meaning to consider: semantic-referential meaning and indexical meaning. Semantic-referential meaning refers to the aspect of meaning, which describes events in the world that are independent of the circumstance they are uttered in. An example would be propositions such as:
In this case, the proposition is describing that Santa Claus eats cookies. The meaning of the proposition does not rely on whether or not Santa Claus is eating cookies at the time of its utterance. Santa Claus could be eating cookies at any time and the meaning of the proposition would remain the same. The meaning is simply describing something that is the case in the world. In contrast, the proposition, "Santa Claus is eating a cookie right now," describes events that are happening at the time the proposition is uttered.
Semantic-referential meaning is also present in meta-semantical statements such as:
If someone were to say that a tiger is a carnivorous animal in one context and a mammal in another, the definition of tiger would still be the same. The meaning of the sign tiger is describing some animal in the world, which does not change in either circumstance.
Indexical meaning, on the other hand, is dependent on the context of the utterance and has rules of use. By rules of use, it is meant that indexicals can tell you when they are used, but not what they actually mean.
Whom "I" refers to depends on the context and the person uttering it.
As mentioned, these meanings are brought about through the relationship between the signified and the signifier. One way to define the relationship is by placing signs in two categories: referential indexical signs, also called "shifters," and pure indexical signs.
Referential indexical signs are signs where the meaning shifts depending on the context hence the nickname "shifters." 'I' would be considered a referential indexical sign. The referential aspect of its meaning would be '1st person singular' while the indexical aspect would be the person who is speaking (refer above for definitions of semantic-referential and indexical meaning). Another example would be:
A pure indexical sign does not contribute to the meaning of the propositions at all. It is an example of a "non-referential use of language."
A second way to define the signified and signifier relationship is C.S. Peirce's Peircean Trichotomy. The components of the trichotomy are the following:
These relationships allow us to use signs to convey what we want to say. If two people were in a room and one of them wanted to refer to a characteristic of a chair in the room he would say "this chair has four legs" instead of "a chair has four legs." The former relies on context (indexical and referential meaning) by referring to a chair specifically in the room at that moment while the latter is independent of the context (semantico-referential meaning), meaning the concept chair.
Michael Silverstein has argued that "nonreferential" or "pure" indices do not contribute to an utterance's referential meaning but instead "signal some particular value of one or more contextual variables." Although nonreferential indexes are devoid of semantico-referential meaning, they do encode "pragmatic" meaning.
The sorts of contexts that such indexes can mark are varied. Examples include:
In all of these cases, the semantico-referential meaning of the utterances is unchanged from that of the other possible (but often impermissible) forms, but the pragmatic meaning is vastly different.
J.L. Austin introduced the concept of the performative, contrasted in his writing with "constative" (i.e. descriptive) utterances. According to Austin's original formulation, a performative is a type of utterance characterized by two distinctive features:
To be performative, an utterance must conform to various conditions involving what Austin calls felicity. These deal with things like appropriate context and the speaker's authority. For instance, when a couple has been arguing and the husband says to his wife that he accepts her apology even though she has offered nothing approaching an apology, his assertion is infelicitous: because she has made neither expression of regret nor request for forgiveness, there exists none to accept, and thus no act of accepting can possibly happen.
Roman Jakobson, expanding on the work of Karl Bühler, described six "constitutive factors" of a speech event, each of which represents the privileging of a corresponding function, and only one of which is the referential (which corresponds to the context of the speech event). The six constitutive factors and their corresponding functions are diagrammed below.
The six constitutive factors of a speech event
The six functions of language
There is considerable overlap between pragmatics and sociolinguistics, since both share an interest in linguistic meaning as determined by usage in a speech community. However, sociolinguists tend to be more interested in variations in language within such communities.
Pragmatics helps anthropologists relate elements of language to broader social phenomena; it thus pervades the field of linguistic anthropology. Because pragmatics describes generally the forces in play for a given utterance, it includes the study of power, gender, race, identity, and their interactions with individual speech acts. For example, the study of code switching directly relates to pragmatics, since a switch in code effects a shift in pragmatic force.
According to Charles W. Morris, pragmatics tries to understand the relationship between signs and their users, while semantics tends to focus on the actual objects or ideas to which a word refers, and syntax (or "syntactics") examines relationships among signs or symbols. Semantics is the literal meaning of an idea whereas pragmatics is the implied meaning of the given idea.
Speech Act Theory, pioneered by J.L. Austin and further developed by John Searle, centers around the idea of the performative, a type of utterance that performs the very action it describes. Speech Act Theory's examination of Illocutionary Acts has many of the same goals as pragmatics, as outlined above.
Computational Pragmatics, as defined by Victoria Fromkin, concerns how humans can communicate their intentions to computers with as little ambiguity as possible. That process, integral to the science of natural language processing (seen as a sub-discipline of artificial intelligence), involves providing a computer system with some database of knowledge related to a topic and a series of algorithms, which control how the system responds to incoming data, using contextual knowledge to more accurately approximate natural human language and information processing abilities. Reference resolution, how a computer determines when two objects are different or not, is one of the most important tasks of computational pragmatics.
There has been a great amount of discussion on the boundary between semantics and pragmatics  and there are many different formalizations of aspects of pragmatics linked to context dependence. Particularly interesting cases are the discussions on the semantics of indexicals and the problem of referential descriptions, a topic developed after the theories of Keith Donnellan. A proper logical theory of formal pragmatics has been developed by Carlo Dalla Pozza, according to which it is possible to connect classical semantics (treating propositional contents as true or false) and intuitionistic semantics (dealing with illocutionary forces). The presentation of a formal treatment of pragmatics appears to be a development of the Fregean idea of assertion sign as formal sign of the act of assertion.
Pragmatics (more specifically, Speech Act Theory's notion of the performative) underpins Judith Butler's theory of gender performativity. In Gender Trouble, she claims that gender and sex are not natural categories, but socially constructed roles produced by "reiterative acting."
In Excitable Speech she extends her theory of performativity to hate speech and censorship, arguing that censorship necessarily strengthens any discourse it tries to suppress and therefore, since the state has sole power to define hate speech legally, it is the state that makes hate speech performative.
Gilles Deleuze and Félix Guattari discuss linguistic pragmatics in the fourth chapter of A Thousand Plateaus ("November 20, 1923--Postulates of Linguistics"). They draw three conclusions from Austin: (1) A performative utterance does not communicate information about an act second-hand, but it is the act; (2) Every aspect of language ("semantics, syntactics, or even phonematics") functionally interacts with pragmatics; (3) There is no distinction between language and speech. This last conclusion attempts to refute Saussure's division between langue and parole and Chomsky's distinction between deep structure and surface structure simultaneously.