package ast
import "github.com/azin-lang/Azin/pkg/ast"
Index
- func ExportDebugTree(node Node, path string) error
- func PrintDebugTree(node Node)
- type AssignmentStmt
- type BadExpr
- type BadStmt
- type BinaryExpr
- type BooleanLiteral
- type CallExpr
- type CharacterLiteral
- type DeferStmt
- type EnumStmt
- type Expr
- type ExpressionStmt
- type FieldDecl
- type FloatLiteral
- type FuncStmt
- type Identifier
- type IfStmt
- type ImportCStmt
- type IntegerLiteral
- type LoopStmt
- type MemberExpr
- type Node
- type Program
- type ReturnStmt
- type Stmt
- type StopStmt
- type StringLiteral
- type StructStmt
- type VarStmt
Functions
func ExportDebugTree
func ExportDebugTree(node Node, path string) error
func PrintDebugTree
func PrintDebugTree(node Node)
Types
type AssignmentStmt
type AssignmentStmt struct { Token token2.Token // = Left Expr Value Expr }
func (*AssignmentStmt) Label
func (*AssignmentStmt) Label() string
func (*AssignmentStmt) Pos
func (a *AssignmentStmt) Pos() token2.Position
func (*AssignmentStmt) TokenLiteral
func (a *AssignmentStmt) TokenLiteral() string
type BadExpr
type BadExpr struct { Token token2.Token }
func (*BadExpr) Equals
func (*BadExpr) Equals(other Expr) bool
func (*BadExpr) Label
func (*BadExpr) Label() string
func (*BadExpr) Pos
func (b *BadExpr) Pos() token2.Position
func (*BadExpr) TokenLiteral
func (b *BadExpr) TokenLiteral() string
func (*BadExpr) Type
func (*BadExpr) Type() *types2.TypeInfo
type BadStmt
type BadStmt struct { Token token2.Token }
func (*BadStmt) Label
func (*BadStmt) Label() string
func (*BadStmt) Pos
func (b *BadStmt) Pos() token2.Position
func (*BadStmt) TokenLiteral
func (b *BadStmt) TokenLiteral() string
type BinaryExpr
type BinaryExpr struct { Left Expr Operator token2.Token Right Expr // SemaResultType contains the result type of the binary operation, set after semantic analysis. SemaResultType *types2.TypeInfo }
func (*BinaryExpr) Equals
func (b *BinaryExpr) Equals(other Expr) bool
func (*BinaryExpr) Label
func (b *BinaryExpr) Label() string
func (*BinaryExpr) Pos
func (b *BinaryExpr) Pos() token2.Position
func (*BinaryExpr) TokenLiteral
func (b *BinaryExpr) TokenLiteral() string
func (*BinaryExpr) Type
func (b *BinaryExpr) Type() *types2.TypeInfo
type BooleanLiteral
type BooleanLiteral struct { Token token2.Token Value bool }
func (*BooleanLiteral) Equals
func (b *BooleanLiteral) Equals(other Expr) bool
func (*BooleanLiteral) Label
func (b *BooleanLiteral) Label() string
func (*BooleanLiteral) Pos
func (b *BooleanLiteral) Pos() token2.Position
func (*BooleanLiteral) TokenLiteral
func (b *BooleanLiteral) TokenLiteral() string
func (*BooleanLiteral) Type
func (b *BooleanLiteral) Type() *types2.TypeInfo
type CallExpr
type CallExpr struct { Callee Expr Args []Expr ResolvedName string // SemaReturnType contains the return type of the function call, set after semantic analysis. SemaReturnType *types2.TypeInfo }
func (*CallExpr) Equals
func (c *CallExpr) Equals(other Expr) bool
func (*CallExpr) Label
func (c *CallExpr) Label() string
func (*CallExpr) Pos
func (c *CallExpr) Pos() token2.Position
func (*CallExpr) TokenLiteral
func (c *CallExpr) TokenLiteral() string
func (*CallExpr) Type
func (c *CallExpr) Type() *types2.TypeInfo
type CharacterLiteral
type CharacterLiteral struct { Token token2.Token Value rune }
func (*CharacterLiteral) Equals
func (c *CharacterLiteral) Equals(other Expr) bool
func (*CharacterLiteral) Label
func (c *CharacterLiteral) Label() string
func (*CharacterLiteral) Pos
func (c *CharacterLiteral) Pos() token2.Position
func (*CharacterLiteral) TokenLiteral
func (c *CharacterLiteral) TokenLiteral() string
func (*CharacterLiteral) Type
func (c *CharacterLiteral) Type() *types2.TypeInfo
type DeferStmt
type DeferStmt struct { Token token2.Token // defer Call Expr }
func (*DeferStmt) Label
func (*DeferStmt) Label() string
func (*DeferStmt) Pos
func (d *DeferStmt) Pos() token2.Position
func (*DeferStmt) TokenLiteral
func (d *DeferStmt) TokenLiteral() string
type EnumStmt
type EnumStmt struct { Token token2.Token // enum Name *Identifier Variants []*Identifier // SemaType contains the type information for the enum, set after semantic analysis. SemaType *types2.TypeInfo }
func (*EnumStmt) Label
func (e *EnumStmt) Label() string
func (*EnumStmt) Pos
func (e *EnumStmt) Pos() token2.Position
func (*EnumStmt) TokenLiteral
func (e *EnumStmt) TokenLiteral() string
type Expr
type Expr interface { Node Equals(other Expr) bool Type() *types2.TypeInfo // contains filtered or unexported methods }
Expr represents an expression node.
type ExpressionStmt
type ExpressionStmt struct { Token token2.Token Expression Expr }
func (*ExpressionStmt) Label
func (e *ExpressionStmt) Label() string
func (*ExpressionStmt) Pos
func (e *ExpressionStmt) Pos() token2.Position
func (*ExpressionStmt) TokenLiteral
func (e *ExpressionStmt) TokenLiteral() string
type FieldDecl
type FieldDecl struct { Name *Identifier // SynType is the AST identifier for the type of the field. It should not be modified. SynType *Identifier Mutable bool // SemaType contains the type information for the field, set after semantic analysis. SemaType *types2.TypeInfo }
func (*FieldDecl) Label
func (f *FieldDecl) Label() string
func (*FieldDecl) Pos
func (f *FieldDecl) Pos() token2.Position
func (*FieldDecl) TokenLiteral
func (f *FieldDecl) TokenLiteral() string
type FloatLiteral
type FloatLiteral struct { Token token2.Token Value float64 }
func (*FloatLiteral) Equals
func (f *FloatLiteral) Equals(other Expr) bool
func (*FloatLiteral) Label
func (f *FloatLiteral) Label() string
func (*FloatLiteral) Pos
func (f *FloatLiteral) Pos() token2.Position
func (*FloatLiteral) TokenLiteral
func (f *FloatLiteral) TokenLiteral() string
func (*FloatLiteral) Type
func (f *FloatLiteral) Type() *types2.TypeInfo
type FuncStmt
type FuncStmt struct { Token token2.Token // fn Name *Identifier Params []*FieldDecl // SynReturnType is the AST identifier for the return type of the function, can be nil for void functions. It should not be modified. SynReturnType *Identifier Body []Stmt CName string // SemaReturnType is the return type of the function, set after semantic analysis. SemaReturnType *types2.TypeInfo }
func (*FuncStmt) Label
func (f *FuncStmt) Label() string
func (*FuncStmt) Pos
func (f *FuncStmt) Pos() token2.Position
func (*FuncStmt) TokenLiteral
func (f *FuncStmt) TokenLiteral() string
type Identifier
type Identifier struct { Token token2.Token Value string // SemaType contains the type information for the identifier, set after semantic analysis. SemaType *types2.TypeInfo }
func (*Identifier) Equals
func (i *Identifier) Equals(other Expr) bool
func (*Identifier) Label
func (i *Identifier) Label() string
func (*Identifier) Pos
func (i *Identifier) Pos() token2.Position
func (*Identifier) TokenLiteral
func (i *Identifier) TokenLiteral() string
func (*Identifier) Type
func (i *Identifier) Type() *types2.TypeInfo
type IfStmt
type IfStmt struct { Token token2.Token // if Condition Expr Then []Stmt Else []Stmt }
func (*IfStmt) Label
func (*IfStmt) Label() string
func (*IfStmt) Pos
func (i *IfStmt) Pos() token2.Position
func (*IfStmt) TokenLiteral
func (i *IfStmt) TokenLiteral() string
type ImportCStmt
type ImportCStmt struct { Token token2.Token Path *StringLiteral }
func (*ImportCStmt) Label
func (i *ImportCStmt) Label() string
func (*ImportCStmt) Pos
func (i *ImportCStmt) Pos() token2.Position
func (*ImportCStmt) TokenLiteral
func (i *ImportCStmt) TokenLiteral() string
type IntegerLiteral
type IntegerLiteral struct { Token token2.Token Value int64 }
func (*IntegerLiteral) Equals
func (i *IntegerLiteral) Equals(other Expr) bool
func (*IntegerLiteral) Label
func (i *IntegerLiteral) Label() string
func (*IntegerLiteral) Pos
func (i *IntegerLiteral) Pos() token2.Position
func (*IntegerLiteral) TokenLiteral
func (i *IntegerLiteral) TokenLiteral() string
func (*IntegerLiteral) Type
func (i *IntegerLiteral) Type() *types2.TypeInfo
type LoopStmt
type LoopStmt struct { Token token2.Token // loop Body []Stmt }
func (*LoopStmt) Label
func (*LoopStmt) Label() string
func (*LoopStmt) Pos
func (l *LoopStmt) Pos() token2.Position
func (*LoopStmt) TokenLiteral
func (l *LoopStmt) TokenLiteral() string
type MemberExpr
type MemberExpr struct { Object Expr Property *Identifier // SemaResultType contains the type of the member access, set after semantic analysis. SemaResultType *types2.TypeInfo }
func (*MemberExpr) Equals
func (m *MemberExpr) Equals(other Expr) bool
func (*MemberExpr) Label
func (m *MemberExpr) Label() string
func (*MemberExpr) Pos
func (m *MemberExpr) Pos() token2.Position
func (*MemberExpr) TokenLiteral
func (m *MemberExpr) TokenLiteral() string
func (*MemberExpr) Type
func (m *MemberExpr) Type() *types2.TypeInfo
type Node
type Node interface { TokenLiteral() string Pos() token2.Position Label() string }
Node is the interface implemented by every AST node.
type Program
type Program struct { Statements []Stmt }
Program is the root of the AST.
func (*Program) Label
func (p *Program) Label() string
func (*Program) Pos
func (p *Program) Pos() token2.Position
func (*Program) TokenLiteral
func (p *Program) TokenLiteral() string
type ReturnStmt
type ReturnStmt struct { Token token2.Token // return Value Expr }
func (*ReturnStmt) Label
func (*ReturnStmt) Label() string
func (*ReturnStmt) Pos
func (r *ReturnStmt) Pos() token2.Position
func (*ReturnStmt) TokenLiteral
func (r *ReturnStmt) TokenLiteral() string
type Stmt
type Stmt interface { Node // contains filtered or unexported methods }
Stmt represents a statement node.
type StopStmt
type StopStmt struct { Token token2.Token // stop }
func (*StopStmt) Label
func (*StopStmt) Label() string
func (*StopStmt) Pos
func (s *StopStmt) Pos() token2.Position
func (*StopStmt) TokenLiteral
func (s *StopStmt) TokenLiteral() string
type StringLiteral
type StringLiteral struct { Token token2.Token Value string }
func (*StringLiteral) Equals
func (s *StringLiteral) Equals(other Expr) bool
func (*StringLiteral) Label
func (s *StringLiteral) Label() string
func (*StringLiteral) Pos
func (s *StringLiteral) Pos() token2.Position
func (*StringLiteral) TokenLiteral
func (s *StringLiteral) TokenLiteral() string
func (*StringLiteral) Type
func (s *StringLiteral) Type() *types2.TypeInfo
type StructStmt
type StructStmt struct { Token token2.Token // struct Name *Identifier Fields []*FieldDecl // SemaType contains the type information for the struct, set after semantic analysis. SemaType *types2.TypeInfo }
func (*StructStmt) Label
func (s *StructStmt) Label() string
func (*StructStmt) Pos
func (s *StructStmt) Pos() token2.Position
func (*StructStmt) TokenLiteral
func (s *StructStmt) TokenLiteral() string
type VarStmt
type VarStmt struct { Token token2.Token // var Name *Identifier // SynType is the AST identifier for the type of the variable. It should not be modified. SynType *Identifier Value Expr Mutable bool // SemaType contains the type information for the variable, set after semantic analysis. SemaType *types2.TypeInfo }
func (*VarStmt) Label
func (v *VarStmt) Label() string
func (*VarStmt) Pos
func (v *VarStmt) Pos() token2.Position
func (*VarStmt) TokenLiteral
func (v *VarStmt) TokenLiteral() string