Clozure Text – A Domain Specific Language for Text Generation

  • Lucy Muthwill

    Student thesis: Master's Thesis

    Abstract

    The goal of this master thesis is to design a domain-specific language for flexible text
    generation named Clozure Text. Additionally, a compiler is developed for the language.
    Control centers of various public sectors like police, emergency medical services or
    fire brigade need the ability to generate text that contains information regarding an
    incident. One example would be to send a fax that contains the number of an incident
    and all the vehicles that were alarmed. Generated texts quickly become increasingly
    complex and might require fetching and preprocessing of data while working with the
    template that is used to generate the text. Ideally, it would be possible to fetch and
    preprocess data from a new source or format it in a way without having to update the
    software of the command centers. This is only possible if the logic for fetching the data
    and formatting it can be implemented directly in the language used to generate the
    text. To enable this we need a domain-specific language in which it is not only possible
    to define simple templates, but also complex logic to fetch and process data.
    Clozure Text is split into three different modes. The default mode in which a program
    starts is the Text Mode. The text mode is used to structure the static text which the
    program generates and enrich it with dynamic information using variables. From this
    mode, it is also possible to enter the other two modes. The Text Generation Mode can
    be used to structure the text. It is possible to loop over lists or only print text under
    certain conditions. The Text Generation Mode and the Text Mode can be mixed. Text
    Mode which is enclosed in a loop will be repeated and Text Mode can be enclosed in
    Text Generation Mode conditions. Finally, we have the Complex Mode that is similar
    to popular programming languages like C#. It is possible to execute complex logic and
    provide information to the other modes in the form of shared variables. Additionally,
    context to all three modes can be provided using JSON.
    We will also take a look at the design and implementation of the compiler. The focus
    of the implementation will be the generation of the IL instructions.
    Finally, we will test the implementation by creating Clozure Text programs and
    validating their output.
    Date of Award2024
    Original languageEnglish (American)
    SupervisorHeinz Dobler (Supervisor) & Felix Kornthaler (Supervisor)

    Cite this

    '