Build A Program

The Gilda class structure constitutes an implicit build system. The compiler can build complete programs and libraries without the use of an external build system (a.k.a. Make files).

Initially you give the compiler the name of a root class. From there you can use the Import declaration within classes to include additional classes in the build.

   import Class, ...          :List classes you want to import.

After all the classes are imported the methods are compiled. If you are building a program only the methods that are actually called by other methods get compiled. Classes often contain methods that are not needed by a particular program and the selective build process prevents unused methods from being included in your program.

In a class file, after the declaration section you list the methods included in the class. Each of these declarations starts with a verb that specifies how the method is compiled. Note that Gilda file names and method names are the same.

   gilda     Method              :Non-generic Gilda method (suffix is .g)
   generic   Method              :Generic Gilda method (suffix is .gg)
   c         File                :C file
   cpp       File                :C++ file
   asm       File                :Assembler file

The Root class you gave to the compiler also needs to declare a method where the program begins running. This is also the first method to be compiled. From there any method it calls gets compiled and so on. Additional methods can be brought into the build by adding dependencies denoted with a right arrow (=>).

   class  Root_Class
   gilda  Root_Method  START    :Specify the first method to compile.
      =>  Extra_Method          :Compile along with the preceeding method.

The last line in a class file is just the keyword, "end". Class files have a ".clg" suffix. The class file for the phonecode example is: phonecode.clg

Class File

Build a Library