Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I haven't used CodeSmith, but I've done a fair bit of code generation. Noteably I wrote most of a configuration management (CM) system for a WiMAX system, where the CM code was generated for 3 different platforms. The only difference was the CM model for each platform.</p> <p>The model was in a custom Domain Specific Language (DSL) that we built had a parser for. The language was a basic container/element style where containers could nest and have an identifier, and elements were of pre-defined types. Documentation was an attribute of elements and containers. You could add <a href="http://www.lua.org/" rel="nofollow">Lua</a> snippets to the element and container definitions to do semantic validation (e.g., the value is in the correct range, if it's an IP address is it in a CIDR range defined elsewhere, etc.).</p> <p>The parser generated a syntax tree that we then pushed at templates. The template language was a partial C implementation of <a href="http://stringtemplate.org/" rel="nofollow">StringTemplate</a>. We used it to generate:</p> <ul> <li>A model specific C API that applications could call into to get configuration values,</li> <li>The collected Lua code for validating the model and providing useful error messages,</li> <li>Two "backends" for the API that would manage values in memory (for temporary manipulation of a model), and in a database system (for sharing amongst processes),</li> <li>Configuration file parser and writer,</li> <li>HTML documentation, and</li> <li>Command Line Interface (CLI) implementation for interactive viewing and changing of a configuration.</li> </ul> <p>In retrospect, I should have simply used Lua directly as the DSL. It would have been more verbose, but having the parser already there and lots of Lua templating choices available to me would have saved a lot of development effort.</p> <p>For things that have a repetivie structure and well defined rules about what those things need to do, code generation can be a wonderful thing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload