Difference between revisions of "Language Reference/Compilation Units"
m (Structure) |
(Namespaces) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
<vipbnf><CompilationItem> : | <vipbnf><CompilationItem> : | ||
<Directive> | <Directive> | ||
<NamespaceEntrance> | |||
<ConditionalItem> | <ConditionalItem> | ||
<InterfaceDefinition> | <InterfaceDefinition> | ||
Line 22: | Line 23: | ||
See also | See also | ||
* {{lang|Interfaces|Interfaces}} | |||
* {{lang|Classes|Classes}} | |||
* {{lang|Implementations|Implementations}} | |||
* {{lang|Namespaces|Namespaces}} | |||
* {{lang2|Clauses|Goal Section|Goal Section}} | |||
* {{lang|Directives|Directives}} | * {{lang|Directives|Directives}} | ||
* {{lang2|Directives| | * {{lang2|Directives|Conditional Compilation|Conditional Item}} | ||
Latest revision as of 11:13, 2 October 2012
A program consists of a number of compilation units. The compiler compiles each of these compilation units separately. The result of a compilation is an object file. These object files (and perhaps other files) are linked together to produce the project target. A program must contain exactly one goalSection, which is the entry point to the program.
A compilation unit has to be self-contained in the sense that all referenced names have to be either declared or defined in the unit. Interface definitions and class declarations can be included in several compilation units (the definitions/declarations must be identical in all units where they are included), whereas class implementations (definitions) may only be defined in a single unit. Every declared item must also be defined in the project, but some items can be defined in libraries, meaning that they do not need a textual definition.
A compilation unit (which is perhaps composed by using #include directives) is a sequence of compilation items.
CompilationUnit : CompilationItem-list-opt
A compilation item is an interface, a class declaration, a class implementation, the goal section or it can be a conditional compilation item, which are described in Conditional Compilation.
CompilationItem : Directive NamespaceEntrance ConditionalItem InterfaceDefinition ClassDeclaration ClassImplementation GoalSection
See also