spc Usage

The page describes the different functions of spc. An spc-command starts with a mode followed by a number of required arguments and then followed by options and flags (optional). The required arguments are determined by the mode. If the mode argument is omitted then spc tries to infer it from the file extension of the first argument.

Mode compile

  • spc --mode=compile FileName.hs
  • spc FileName.hs (only works with file extension .hs)

Reads a Haskell source code file and loads the sp-programs which it references. Then it translates them into Haskell code and inserts them into this file. The sp-programs must be stored in a directory with the same name as the filename without the extension. For example, an sp-program called bubbleSort referenced from FileName.hs must be stored in FileName/bubbleSort.sp.

Options:

  • --outputFile=xyz.hs writes output to a different file

  • --remOpt=optionKey ignores any options in the sp-files with the given key

  • --defOpt=option if an sp-file does not contain an option with the same key then this one is used (default option). if option contains whitespaces then enclose it in ", e.g. "--defOpt=TRANSLATION Production"
  • --setOpt=option forces option even if the sp-file contains a different one (same as combining --remOpt and --defOpt)

Flags:

  • --printOutput causes output to be printed to the terminal instead of overwriting the source code file
  • --clear removes everything between --START OF PROGRAM xxx and --END OF PROGRAM xxx

Mode transpile

  • spc --mode=transpile programName.sp
  • spc programName.sp (only works with file extension .sp)

Loads an sp-program and translates it into Haskell code. The result it written to programName.hs.

Options:

  • --outputFile=xyz.hs writes output to a different file
  • --remOpt=optionKey same as in compile-mode
  • --defOpt=option same as in compile-mode
  • --setOpt=option same as in compile-mode

Flags:

  • --printOutput causes output to be printed to the terminal instead of writing it to a file

Mode compare

  • spc --mode=compare trace1.csv trace2.csv
  • spc trace1.csv trace2.csv (only works with file extension .csv)

Compares two execution traces and determines if they are equal or not.

Flags:

  • --onlyOps only compares the operation columns of the two traces
  • --onlyValues only compares the variable columns of the two traces

Mode compareDirs

  • spc --mode=compareDirs dir1 dir2

Compares every trace in directory dir1 with a trace which has the same filename in the directory dir2. Every file with the extension .csv is assumed to be a trace. The result is printed to the terminal.

Flags:

  • --omitEqual if two traces are equal they are omitted from the result
  • --omitSubtrace12 if the trace from dir1 is a subtrace of the one from dir2 then they are omitted from the result
  • --omitSubtrace21 analogous to the previous flag
  • --onlyOps same as in --mode=compare
  • --onlyValues same as in --mode=compare

Mode coverage

  • spc --mode=coverage programName.sp traceDir

Prints the code coverage of the sp-program based on the traces in traceDir.

Flags:

  • --omitBdts does not include paths of BDTs in the result

Mode failedTraces

  • spc --mode=failedTraces traceDir

Prints every trace in traceDir which contains a failed operation or predicate.