resolver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2017 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 *Mappings) (*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 Mappings

type Mappings struct {
	parser.ParseMap
	ASTToSemantic map[ast.Node][]semantic.Node
	SemanticToAST map[semantic.Node][]ast.Node
}

Mappings is a two-way relational map of AST nodes to semantic nodes.

func NewMappings

func NewMappings() *Mappings

NewMappings returns a new, initialized Mappings struct.

func (*Mappings) MergeIn

func (m *Mappings) MergeIn(other *Mappings)

MergeIn merges the mappings in other into m.

func (*Mappings) ParseNode

func (m *Mappings) ParseNode(sem semantic.Node) parse.Node

ParseNode returns the primary parse node for the semantic node. If the semantic node has no parse node then nil is returned.

Jump to

Keyboard shortcuts

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