/PATO-ROSE

PATO - Program Analysis Through Ontology

Primary LanguageC

PATO - Program Analysis Through Ontology

A brief description of the PATO project is here. This repository is based on the ROSE compiler.

Getting Started

Installation

  1. Follow the instruction 1 and 2 to install EDG 4.x-based ROSE.
  2. Edit set.rose to set the correct PATH to your install and run . set.rose.
  3. $ cd tools/onto-build-rose/ and run make

Directory Structure

  • ontology/ - The owl files defining the used concepts (vocabularies, relations, etc) are put here. This is the core ontology and can be regarded as the meta-model for the program. It is not the generated ontology from programs.
  • projects/ - It contains separate analysis projects. Currently they are prototyped with Prolog to implement different program analysis over the generated ontology of program. There are "canonical loop analysis" and "control flow graph"(CFG) analysis.
  • test/ - Some benchmarks for testing.
  • tools/onto-build-rose - It includes the frontend to build the knowledge from program, i.e., the ontology generator. It's a parser for C program built on ROSE compiler. If you want to extend the parser to cover more language features or structures, you can start with rosePrgKnowledgeBuilder.h/cpp. It essentially implements an AST traversal to extract information from the program. The OntoGeneratorInterface.hpp defines some interfaces for generating different format of the ontology (owl, ttl, pl).

Usage

  1. Generate knowledge base from program, represented as ontology or linked data

     $ rosePrgKnowledgeBuilder.exe -c -w -emit-owl out.owl input.c [-I/extra-include-dir]
    
  2. Run a program analysis based on logic inference (as Prolog script)

    Canonical Loop

     $ swipl --nosignal --quiet projects/canonicalloop/run.pl out.owl report.txt
    

    or CFG

     $ swipl --nosignal --quiet projects/cfg/run.pl out.owl report.txt
    

See Also

Another sub-project implementing the pointer analysis is in repository. If you are interested in extending the project, that one is recommended. We shift the C program parser to more popular Clang.