Printing the declarations and code in a file

Author(s): Manuel Hermenegildo.

A simple program for printing assertion information (predicate declarations, property declarations, type declarations, etc.) and printing code-related information (imports, exports, libraries used, etc.) on a file. The file should be a single Ciao or Prolog source file. It uses the Ciao compiler's pass one to do it. This program is specially useful for example for checking what assertions the assertion normalizer is producing from the original assertions in the file or to check what the compiler is actually seeing after some of the syntactic expansions (but before goal translations).

Usage (fileinfo)

   
    fileinfo -asr <filename.asr> 
       : pretty prints the contents of <filename.asr> 

    fileinfo [-v] [-m] <-a|-f|-c|-e> <filename>
    -v : verbose output (e.g., lists all files read)
    -m : restrict info to current module
    -a : print assertions 
    -f : print code and interface (imports/exports, etc.)
    -c : print code only
    -e : print only errors - useful to check syntax of assertions in file

    fileinfo -h
       : print this information

   

More detailed explanation of options (fileinfo)

  • If the -a option is selected, fileinfo prints the assertions (only code-oriented assertions -- not comment-oriented assertions) in the file after normalization. If the -f option is selected fileinfo prints the file interface, the declarations contained in the file, and the actual code. The -c option prints only the code. If the -e option is selected fileinfo prints only any sintactic and import-export errors found in the file, including the assertions.

  • filename must be the name of a Prolog or Ciao source file.

  • If the -m option is selected, only the information related to the current module is printed.

  • The -v option produces verbose output. This is very useful for debugging, since all the files accessed during assertion normalization are listed.

  • In the -asr usage, fileinfo can be used to print the contents of a .asr file in human-readable form.