Kibo Internal

Introduction

For each StringTemplate file filename.ext.stg found in the template directory, the kibo render the StringTemplate (.stg) file by calling the root template main(m) ::= <...> with the Template Model produced by the converter and save the generated code to output/filename.ext.

The template model is a specialized projection of all dsm definitions for generating repetitive code. A programming language Converter projects all dsm definitions to the extended type system of the language by using basic types (boolean, integer, real) and containers available in its standard library (vector, set, map, optional, ...).

Packages

com.digitalsubstrate.converter

This package contains the class Converter used to convert a DSMDefinitions to a TemplateDefinitions.

com.digitalsubstrate.kibo

This package contains the classes for the application.

com.digitalsubstrate.vipe

This package contains all the required classes to get a java implementation of a TypeName, NameSpace and Graph.

com.digitalsubstrate.viper.dsm

This package contains all the required classes to get a java implementation of a Viper::DSMDefinitions.

com.digitalsubstrate.viper.stream

This package contains all the required classes to get a java implementation of a Viper::StreamTokenBinaryDecoder.

com.digitalsubstrate.template

This packet contains all the classes for the template model consumed by the StringTemplate engine.

How it works

1) The StreamTokenBinary representation of the DSM Definitions is read by the class DSMDefinitionsDecoder with the help of the binary decoder StreamTokenBinaryDecoder. 2) The DSMDefinitions is converted to a TemplateDefinitions adapted for templating. 3) The root object TemplateDefinitions is injected in the root rule main of a StringTemplate.

During step 2, complicated things are transformed to a simple string representation to keep StringTemplate rules simple and reduce the rule's logic. All types are recursively decomposed to produce typeSuffix and elementTypeSuffix used by the recursive type generation in a StringTemplate.

See Kibo_Template_Model for a detail description of the TemplateModel seen by the StringTemplate engine and the mechanism used for recursive type generations.