next up previous contents
Next: Lexical Structure Up: The Cool Reference Manual1 Previous: Bool   Contents

Main Class

Every program must have a class Main. Furthermore, the Main class must have a method main that takes no formal parameters. The main method may be defined in class Main or it may be inherited from another class. A program is executed by evaluating (new Main).main().

The remaining sections of this manual provide a more formal definition of Cool. There are four sections covering lexical structure (Section 10), grammar (Section 11), type rules (Section 12), and operational semantics (Section 13).