Philosophical semantics (the study or science of meaning in language) tends to focus on the principle of compositionality in order to explain the relationship between meaningful parts and whole sentences. The principle asserts that a sentence can be understood on the basis of the meaning of the parts of the sentence (words or morphemes) along with an understanding of its structure (syntax or logic). Therefore, the meaning of a complex expression is determined by the meanings of its constituent expressions and the rules used to combine them.
Functions can also be used to describe the meaning of a sentence: a propositional function is an operation of language that takes an entity (or subject) as an input and outputs a semantic fact (or proposition).
There are two general methods of understanding the relationship between the parts of a linguistic string and how it is put together:
Syntactic trees: focus on the words of a sentence with the grammar of the sentence in mind.
Semantic trees: focus on the role of the meaning of the words and how those meanings combine.