Language Reference/Compilation Units

From wiki.visual-prolog.com

Jump to: navigation, search
Language Reference

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

Personal tools