Driver

A driver is a python script which applies one or more translations to a source file, producing an output (usually a destination file).

Drivers usually follow this structure:

... imports ....
##################### Parse command line arguments
output_file = ... whatever code to get the output file name ....

###################### First Layer  : File parsing
# Parse file
from Frontend.Parse import parse_source
template_code = ... whatever code to get a string with source code from the input file ...
ast = parse_source(template_code, filename)
print " OK "
print " Migrating to Internal Representation ....",
from Frontend.InternalRepr import AstToIR
# Transform the C ast into the internal representation
migrator = AstToIR(Writer = OmpWriter, ast = ast)
migrator.transform()
new_ast = migrator.ast
print " OK "
###################### Second Layer  : Transformation tools
.... whatever mutators .....
############################################
# Write file
.... whatever tool to ouput the file ....
v = CWriter(filename = output_file)
v.visit(new_ast)

You can see some example drivers in the bin directory of the project .. [XXX describir en algún punto la estructura de directorios del proyecto].

C to C

The C to C driver only make a direct translation from a C source file to a C source file. This driver is implemented to check that the parsing frontend and the writer tools are working properly. No mutation is applied in this driver.

llc to CUDA driver

The llc to CUDA driver is called c2cu.py, and it is located on the bin directory of the project. The mutations from the Cuda are applied when this driver is invoked.

C to Dot driver

The c2dot.py driver reads .. [XXX complete]

Table Of Contents

Previous topic

yaCF Architecture

Next topic

Frontend

This Page