[target]
    extension    = c
    command      = "gcc -O2 -Wall %s %s -o %s"
    linear       = no
    comment      = "/* %s */"
    width        = 50
    init         = "#include <stdio.h>\n"
    identifier   = "%s"
    alternative  = "(%s) ? (%s) : (%s)"
    pre-start    = "\nvoid main(void) {\n start:"
    pre-init     = "\n init:" pre-loop = "\n loop:"
    exit         = " if (%s) exit(0);"
    pre-stop     = "\n stop:"
    pre-next     = "\n next:"
    post-next    = "\n goto loop;\n}"
    [int]
    declare      = "static int %s;"
    assign       = " %s = %s;"
    init         = /* get/putint functions */\
                   int getint(int port) {\
                     int tmp;\
                     if (scanf ("%d", &tmp) == EOF)\
                       exit(0);\
                     return tmp;\
                   }\
                   #define putint(port,value)\
                       printf("%d\n", value)
    data         = "%s"
    +/-          = int->int, "- (%s)"
    +            = int->int->int, "(%s) + (%s)"
    -            = int->int->int, "(%s) - (%s)"
    *            = int->int->int, "(%s) * (%s)"
    /            = int->int->int, "(%s) / (%s)"
    %            = int->int->int, "(%s) % (%s)"
    =            = int->int->int, "(%s) == (%s)"
    >            = int->int->int, "(%s) > (%s)"
    <            = int->int->int, "(%s) < (%s)"
    >=           = int->int->int, "(%s) >= (%s)"
    <=           = int->int->int, "(%s) <= (%s)"
    <>           = int->int->int, "(%s) != (%s)"
    <<           = int->int->int, "(%s) << (%s)"
    >>           = int->int->int, "(%s) >> (%s)"
    &            = int->int->int, "(%s) & (%s)"
    |            = int->int->int, "(%s) | (%s)"
    ^            = int->int->int, "(%s) ^ (%s)"
    &&           = int->int->int, "(%s) && (%s)"
    ||           = int->int->int, "(%s) || (%s)"
    zero         = int->int, "(%s) == 0"
    @in          = int->int, "getint (%s)"
    @out         = int->int->int, "putint (%s, %s)"
 
FEATURES
  • TCDF contains some definitions
  • Each definition is a template. Here, only the printf tamplate is used
  • for each algebra, the TCDF binds the operator to code
  • the nature of the code is not imposed
  • The C TCDF is very simple. 
  • Instead of the printf template, a TCDF could uses the SLANG template, an interpreted language