resolver

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2018 License: Apache-2.0 Imports: 11 Imported by: 21

Documentation

Overview

Package resolver implements a semantic resolving for the api language. It is responsible for converting from an abstract syntax tree to a typed semantic graph ready for code generation.

Index

Constants

View Source
const (
	RefRune     = 'ʳ'
	SliceRune   = 'ˢ'
	ConstRune   = 'ᶜ'
	PointerRune = 'ᵖ'
	ArrayRune   = 'ᵃ'
	MapRune     = 'ᵐ'
	TypeRune    = 'ː'

	RefSuffix     = string(RefRune)
	SliceSuffix   = string(SliceRune)
	ConstSuffix   = string(ConstRune)
	PointerSuffix = string(PointerRune)
	ArraySuffix   = string(ArrayRune)
	MapSuffix     = string(MapRune)
	TypeInfix     = string(TypeRune)
)

Variables

This section is empty.

Functions

func Resolve

func Resolve(includes []*ast.API, mappings *semantic.Mappings, options Options) (*semantic.API, parse.ErrorList)

Resolve takes valid asts as produced by the parser and converts them to the semantic graph form. If the asts are not fully valid (ie there were parse errors) then the results are undefined. If there are semantic problems with the ast, Resolve will return the set of errors it finds, and the returned graph may be incomplete/invalid.

Types

type Options added in v1.2.0

type Options struct {
	// ExtractCalls moves all call expressions to subroutines out to locals.
	// This is done so that there is an oppotunity to test for abort() before
	// executing the rest of the expression.
	ExtractCalls bool

	// RemoveDeadCode removes if statement blocks when the conditional is a
	// literal false. The primary use of this code is to eliminate conditional
	// blocks inside macros that are directly dependent on a boolean parameter.
	RemoveDeadCode bool
}

Options customize the final output of the resolve.

Jump to

Keyboard shortcuts

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