Documentation ¶
Overview ¶
Package goose implements conversion from Go source to Perennial definitions.
The exposed interface allows converting individual files as well as whole packages to a single Coq Ast with all the converted definitions, which include user-defined structs in Go as Coq records and a Perennial procedure for each Go function.
See the Goose README at https://github.com/goose-lang/goose for a high-level overview. The source also has some design documentation at https://github.com/goose-lang/goose/tree/master/docs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConversionError ¶
type ConversionError struct { Category string // the main description of what went wrong Message string // the snippet in the source program responsible for the error GoCode string // (for internal debugging) file:lineno for the goose code that threw the // error GooseCaller string // file:lineno for the source program where GoCode appears GoSrcFile string // (for systematic tests) Pos, End token.Pos }
A ConversionError is a detailed and structured error encountered while converting Go to Coq.
Errors include a category describing the severity of the error.
The category "unsupported" is the only error that should result from normal usage, when attempting to use a feature goose intentionally does not support.
"todo" and "future" are markers for code that could be supported but is not currently handled.
The categories "impossible(go)" and "impossible(no-examples)" indicate a bug in goose (at the very least these cases should be checked and result in an unsupported error)
func (*ConversionError) Error ¶
func (e *ConversionError) Error() string
type Ctx ¶
Ctx is a context for resolving Go code's types and source code
func NewPkgCtx ¶
func NewPkgCtx(pkg *packages.Package, tr TranslationConfig) Ctx
NewPkgCtx initializes a context based on a properly loaded package
type ExprValUsage ¶
type ExprValUsage int
ExprValUsage says how the result of the currently generated expression will be used
const ( // ExprValLocal means result of this expression will only be used locally, // or entirely discarded ExprValLocal ExprValUsage = iota // ExprValReturned means the result of this expression will be returned from // the current function (i.e., the "early return" control effect is // available here) ExprValReturned // ExprValLoop the result of this expression will control the current loop // (i.e., the "break/continue" control effect is available here) ExprValLoop )
type MultipleErrors ¶
type MultipleErrors []error
func (MultipleErrors) Error ¶
func (es MultipleErrors) Error() string
type PkgConfig ¶
type PkgConfig struct { TranslationConfig Ffi string }
PkgConfig holds package configuration for Coq conversion
type TranslationConfig ¶
TranslationConfig has global configuration for translation
func (TranslationConfig) TranslatePackages ¶
func (tr TranslationConfig) TranslatePackages(modDir string, pkgPattern ...string) (files []coq.File, errs []error, patternErr error)
TranslatePackages loads packages by a list of patterns and translates them all, producing one file per matched package.
The errs list contains errors corresponding to each package (in parallel with the files list). patternErr is only non-nil if the patterns themselves have a syntax error.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
internal
|
|
examples/append_log
Append-only, sequential, crash-safe log.
|
Append-only, sequential, crash-safe log. |
examples/async
async just uses the async disk FFI
|
async just uses the async disk FFI |
examples/comments
comments tests package comments, like this one
|
comments tests package comments, like this one |
examples/simpledb
Package simpledb implements a one-table version of LevelDB
|
Package simpledb implements a one-table version of LevelDB |
examples/unittest
unittest is a package full of many independent and small translation examples
|
unittest is a package full of many independent and small translation examples |
Package machine is a support library for generic Go primitives.
|
Package machine is a support library for generic Go primitives. |
filesys
Package filesys is a support library providing access to a single directory in the filesystem.
|
Package filesys is a support library providing access to a single directory in the filesystem. |