Contracts are legally enforceable agreements between two or more parties. The agreements can contain temporally based conditions, such as actions taken by the contract parties or events that happen, that trigger changes to the state of the contract when the conditions become true. Since the structure of these conditions can be very complex, it can be difficult to write contracts in a natural language in a clear and unambiguous way. A better approach is to have a formal language with a precise semantics to represent contracts. Contracts expressed in such a language have a mathematically precise meaning and can be written, analyzed, and manipulated by software.This thesis presents fcl, a formal language with a precise semantics for writing general contracts that may depend on temporally based conditions. Motivated by carefully selected examples of contracts, we derive a set of desirable requirements that a formal language of contracts should support. Based on the requirements, we clearly define the notion of contract and address what it means to fulfill or breach a contract. We present the formal syntax and semantics of fcl. We also successfully formalize different kinds of contracts in fcl and develop a reasoning system for fcl.iii First and foremost, I would like to express my gratitude to my academic supervisor Dr. William M. Farmer for his unwavering support, invaluable guidance, and continuous encouragement throughout the development and advancement of my research studies and my life. My special thanks go to the members of my supervisory committee: Dr. Jacques Carette, Dr. Ridha Khedri, and Dr. Tom Maibaum for all of their valuable advices and thoughtful comments on my research work. I also appreciate the help and moral support from all of other individuals whom I have interacted with throughout my graduate studies. Furthermore, I want to extend my sincere thanks to the Natural Sciences and Engineering Research Council of Canada (NSERC) and McMaster University graduate scholarship which have provided the financial support during my doctoral studies.Last, but certainly not least, I would like to thank my dear family and friends from the bottom of my heart for all of their love, support, and encouragement.