apast

package
v0.0.0-...-8c29c1c Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2016 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package apast defines a simplified AST format that is easy to interpret. We make a number of simplifying assumptions:

  • We assume that the code already compiles, so we don't check things like type errors.
  • There are no operators; they are replaced by function calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayLiteralExpr

type ArrayLiteralExpr struct {
	Type Expr
	Vals []Expr
}

type AssignStmt

type AssignStmt struct {
	Lhs []Expr
	Rhs []Expr
}

type BlockStmt

type BlockStmt struct {
	Stmts []Stmt
}

type BreakStmt

type BreakStmt struct {
}

type EmptyStmt

type EmptyStmt struct {
}

type Expr

type Expr interface {
	// contains filtered or unexported methods
}

type ExprStmt

type ExprStmt struct {
	E Expr
}

type FieldAccessExpr

type FieldAccessExpr struct {
	E    Expr
	Name string
}

type ForStmt

type ForStmt struct {
	Init Stmt
	Cond Expr
	Post Stmt
	Body Stmt
}

All fields are required.

type FuncCallExpr

type FuncCallExpr struct {
	Func Expr
	Args []Expr
}

func (*FuncCallExpr) String

func (e *FuncCallExpr) String() string

type FuncDecl

type FuncDecl struct {
	Body       Stmt
	ParamNames []string
}

type IdentExpr

type IdentExpr struct {
	Name string
}

func (*IdentExpr) String

func (e *IdentExpr) String() string

type IfStmt

type IfStmt struct {
	Init Stmt
	Cond Expr
	Body Stmt
	Else Stmt
}

All fields are required.

type IndexExpr

type IndexExpr struct {
	E     Expr
	Index Expr
}

type LiteralExpr

type LiteralExpr struct {
	Val interface{}
}

func (*LiteralExpr) String

func (e *LiteralExpr) String() string

type MethodDecl

type MethodDecl struct {
	// Variable name for the receiver param.
	ReceiverName string
	IsPointer    bool
	Func         *FuncDecl
}

type Package

type Package struct {
	Funcs map[string]*FuncDecl
	// All methods are attached to their corresponding types.
	Types map[string]*TypeDecl
}

type ReturnStmt

type ReturnStmt struct {
	Results []Expr
}

type SliceLiteralExpr

type SliceLiteralExpr struct {
	Type Expr
	Vals []Expr
}

type Stmt

type Stmt interface {
	// contains filtered or unexported methods
}

type StructLiteralExpr

type StructLiteralExpr struct {
	TypeName      string
	InitialValues map[string]Expr
}

type TypeDecl

type TypeDecl struct {
	Methods map[string]*MethodDecl
}

Jump to

Keyboard shortcuts

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