Pick apart the syntax of the sentence "John loves to swim".
The sentence "John loves to swim" is composed of two clauses: the subject "John" and the verb "loves"; the phrase "to swim" is a phrase describing the action. The clauses are connected by the conjunction "to".
The sentence "John loves to swim" has three parts: a subject ("John") and two gerunds ("loves" and "to swim"). The subject is a pronoun and is not needed for the sentence to be understandable. The two gerunds ("loves" and "to swim") are connected by the verb "love" and form a single verb phrase. The phrase is followed by the phrase "to do" where "to swim" is the direct object and "love" is the verb.