gospal

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2019 License: Apache-2.0

README

gospal GoDoc

Go Static Program AnaLysing framework

This is a research prototype static analyser for Go programs. Currently the framework consists of two main tools, migoinfer and ssaview, but it should be able to build more backends with different output formats based on this framework.

To build the tool, use go get:

go get github.com/nickng/gospal/cmd/...
migoinfer

The MiGo infer tool (cmd/migoinfer) infers MiGo types from a Go source code. The formal definitions of the MiGo types are published in this paper, and the format of the output in textual form is described in the migo package.

For example, given this sample program main.go,

package main

func main() {
	ch := make(chan int)
	go Sender(ch)
	fmt.Println(<-ch)
}

func Sender(ch chan int) {
	ch <- 1
}

This is the expected output of the inference, with additional output defs that does not involve communication.

$ migoinfer main.go

def main.main():
    let t0 = newchan main.main0.t0_chan0, 0;
    spawn main.Sender(t0);
    recv t0;
def main.Sender(ch):
    send ch

This is a research prototype and does not cover all features of Go. Please report errors with a small fragment of sample code and what you expect to see, however, noting that it might not be possible to infer the types soundly due to the limitations of static analysis.

ssaview

The SSA viewer (cmd/ssaview) is a wrapper over the ssa package from the extra tools of the Go project for viewing SSA-form of a given source code. It is similar to ssadump but shares the build configuration with the migoinfer tool in this project.

Directories

Path Synopsis
Package block provides the Analyser interface for blocks and supporting utils.
Package block provides the Analyser interface for blocks and supporting utils.
Package callctx defines a function call Context for static analysis.
Package callctx defines a function call Context for static analysis.
cmd
migoinfer
Command migoinfer is the command line entry point to MiGo type inference.
Command migoinfer is the command line entry point to MiGo type inference.
ssaview
Command ssaview is a SSA printer using standard static analysis options.
Command ssaview is a SSA printer using standard static analysis options.
Package fn provides the Analyser interface for functions and supporting utils.
Package fn provides the Analyser interface for functions and supporting utils.
Package funcs is a wrapper for functions to create a uniform representation for function-like constructs in Go.
Package funcs is a wrapper for functions to create a uniform representation for function-like constructs in Go.
Package instr provides the Analyser interface for instructions.
Package instr provides the Analyser interface for instructions.
Package loop provides utilities for loop representation and detection.
Package loop provides utilities for loop representation and detection.
Package pkg provides the Analyser interface for package.
Package pkg provides the Analyser interface for package.
Package prog provides the Analyser interface for programs.
Package prog provides the Analyser interface for programs.
ssa
Package ssa is a library to build and work with SSA.
Package ssa is a library to build and work with SSA.
build
Package build is a helper package for building SSA IR in the parent directory.
Package build is a helper package for building SSA IR in the parent directory.
Package store provides interfaces for a key-value store.
Package store provides interfaces for a key-value store.
chans
Package chans implements store.Value of type chan.
Package chans implements store.Value of type chan.
structs
Package structs implements store.Value for composite struct type.
Package structs implements store.Value for composite struct type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL