Documentation ¶
Index ¶
- func ALlPathReturn(body *BoundBlockStatements) bool
- func NodeText(node BoundNode) string
- func PrintBoundFunctions(w io.Writer, funcs map[*symbol.FunctionSymbol]*BoundBlockStatements) error
- func PrintBoundProgram(w io.Writer, funcs map[*symbol.FunctionSymbol]*BoundBlockStatements, ...) error
- func PrintBoundTree(w io.Writer, node BoundNode) error
- func WriteAssignmentExpression(w write.WriteIndent, node *BoundAssignmentExpression)
- func WriteBinaryExpression(w write.WriteIndent, node *BoundBinaryExpression)
- func WriteBlockStatement(w write.WriteIndent, node *BoundBlockStatements)
- func WriteCallExpression(w write.WriteIndent, node *BoundCallExpression)
- func WriteConditionalGotoStatement(w write.WriteIndent, node *ConditionalGotoStatement)
- func WriteErrorExpression(w write.WriteIndent, node *BoundErrorExpression)
- func WriteExpressionStatement(w write.WriteIndent, node *BoundExpressStatements)
- func WriteGotoStatement(w write.WriteIndent, node *GotoStatement)
- func WriteLabelStatement(w write.WriteIndent, node *LabelStatement)
- func WriteLiteralExpression(w write.WriteIndent, node *BoundLiteralExpression)
- func WriteNestedExpression(w write.WriteIndent, parentPrecedence int, expression BoundExpression)
- func WriteNestedExpressionSon(w write.WriteIndent, parentPrecedence int, currentPrecedence int, ...)
- func WriteReturnStatement(w write.WriteIndent, node *BoundReturnStatements)
- func WriteTo(w io.Writer, node BoundNode)
- func WriteUnaryExpression(w write.WriteIndent, node *BoundUnaryExpression)
- func WriteVariableDeclaration(w write.WriteIndent, node *BoundVariableDeclaration)
- func WriteVariableExpression(w write.WriteIndent, node *BoundVariableExpression)
- type BasicBlock
- type BasicBlockBranch
- type Binder
- func (b *Binder) BindAssignmentExpress(express *syntax.AssignmentExpress) BoundExpression
- func (b *Binder) BindBinaryOperator(express *syntax.BinaryExpress) BoundExpression
- func (b *Binder) BindBlockStatement(s *syntax.BlockStatement) Boundstatement
- func (b *Binder) BindCallExpression(express *syntax.CallExpress) BoundExpression
- func (b *Binder) BindExpression(express syntax.Express, canBeUnit bool) BoundExpression
- func (b *Binder) BindExpressionAndCheckType(express syntax.Express, targetType *symbol.TypeSymbol) BoundExpression
- func (b *Binder) BindExpressionInternal(express syntax.Express) BoundExpression
- func (b *Binder) BindExpressionStatement(es *syntax.ExpressStatement) Boundstatement
- func (b *Binder) BindForStatement(s *syntax.ForStatement) Boundstatement
- func (b *Binder) BindFunctionDeclaration(s *syntax.FunctionDeclarationSyntax)
- func (b *Binder) BindIfStatement(s *syntax.IfStatement) Boundstatement
- func (b *Binder) BindLiteralExpress(express *syntax.LiteralExpress) BoundExpression
- func (b *Binder) BindLoopBody(body syntax.Statement) (res Boundstatement, breakLabel *BoundLabel, continueLabel *BoundLabel)
- func (b *Binder) BindNameExpress(express *syntax.NameExpress) BoundExpression
- func (b *Binder) BindReturnStatement(s *syntax.ReturnStatement) Boundstatement
- func (b *Binder) BindStatement(s syntax.Statement) Boundstatement
- func (b *Binder) BindTypeClause(s *syntax.TypeClauseSyntax) *symbol.TypeSymbol
- func (b *Binder) BindUnaryExpress(express *syntax.UnaryExpress) BoundExpression
- func (b *Binder) BindUnitExpression(express *syntax.UnitExpress) BoundExpression
- func (b *Binder) BindVariableDeclaration(s *syntax.VariableDeclarationSyntax) Boundstatement
- func (b *Binder) BindVariableSymbol(identifier syntax.SyntaxToken, isReadOnly bool, tp *symbol.TypeSymbol) symbol.VariableSymbol
- func (b *Binder) BindWhileStatement(s *syntax.WhileStatement) Boundstatement
- type BoundAssignmentExpression
- type BoundBinaryExpression
- type BoundBinaryOperator
- type BoundBinaryOperatorKind
- type BoundBlockStatements
- type BoundCallExpression
- type BoundErrorExpression
- type BoundExpressStatements
- type BoundExpression
- type BoundForStatements
- type BoundGlobalScope
- type BoundIfStatements
- type BoundLabel
- type BoundLiteralExpression
- type BoundLoopStatements
- type BoundNode
- type BoundNodeKind
- type BoundReturnStatements
- type BoundScope
- func (s *BoundScope) GetDeclareFunctions() []*symbol.FunctionSymbol
- func (s *BoundScope) GetDeclareVariables() []symbol.VariableSymbol
- func (s *BoundScope) TryDeclareFunction(function *symbol.FunctionSymbol) bool
- func (s *BoundScope) TryDeclareVariable(variable symbol.VariableSymbol) bool
- func (s *BoundScope) TryLookupFunction(name string) (*symbol.FunctionSymbol, bool)
- func (s *BoundScope) TryLookupVariable(name string) (symbol.VariableSymbol, bool)
- type BoundUnaryExpression
- type BoundUnaryOperator
- type BoundUnaryOperatorKind
- type BoundUnitExpression
- type BoundVariableDeclaration
- type BoundVariableExpression
- type BoundWhileStatements
- type Boundstatement
- type ConditionalGotoStatement
- type ControlFlowGraph
- type DataMaps
- type DataMapsIter
- type GotoStatement
- type GraphBuilder
- func (g *GraphBuilder) Build(blocks *DataMaps[BasicBlock]) *ControlFlowGraph
- func (g *GraphBuilder) Connect(from, to *BasicBlock, condition BoundExpression)
- func (g *GraphBuilder) Negate(condition BoundExpression) BoundExpression
- func (g *GraphBuilder) RemoveBlock(blocks *DataMaps[BasicBlock], block *BasicBlock)
- type LabelStatement
- type NodePrint
- type Stringer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ALlPathReturn ¶
func ALlPathReturn(body *BoundBlockStatements) bool
func PrintBoundFunctions ¶
func PrintBoundFunctions(w io.Writer, funcs map[*symbol.FunctionSymbol]*BoundBlockStatements) error
func PrintBoundProgram ¶
func PrintBoundProgram(w io.Writer, funcs map[*symbol.FunctionSymbol]*BoundBlockStatements, statement BoundNode) error
func WriteAssignmentExpression ¶
func WriteAssignmentExpression(w write.WriteIndent, node *BoundAssignmentExpression)
func WriteBinaryExpression ¶
func WriteBinaryExpression(w write.WriteIndent, node *BoundBinaryExpression)
func WriteBlockStatement ¶
func WriteBlockStatement(w write.WriteIndent, node *BoundBlockStatements)
func WriteCallExpression ¶
func WriteCallExpression(w write.WriteIndent, node *BoundCallExpression)
func WriteConditionalGotoStatement ¶
func WriteConditionalGotoStatement(w write.WriteIndent, node *ConditionalGotoStatement)
func WriteErrorExpression ¶
func WriteErrorExpression(w write.WriteIndent, node *BoundErrorExpression)
func WriteExpressionStatement ¶
func WriteExpressionStatement(w write.WriteIndent, node *BoundExpressStatements)
func WriteGotoStatement ¶
func WriteGotoStatement(w write.WriteIndent, node *GotoStatement)
func WriteLabelStatement ¶
func WriteLabelStatement(w write.WriteIndent, node *LabelStatement)
func WriteLiteralExpression ¶
func WriteLiteralExpression(w write.WriteIndent, node *BoundLiteralExpression)
func WriteNestedExpression ¶
func WriteNestedExpression(w write.WriteIndent, parentPrecedence int, expression BoundExpression)
func WriteNestedExpressionSon ¶
func WriteNestedExpressionSon(w write.WriteIndent, parentPrecedence int, currentPrecedence int, expression BoundExpression)
func WriteReturnStatement ¶
func WriteReturnStatement(w write.WriteIndent, node *BoundReturnStatements)
func WriteUnaryExpression ¶
func WriteUnaryExpression(w write.WriteIndent, node *BoundUnaryExpression)
func WriteVariableDeclaration ¶
func WriteVariableDeclaration(w write.WriteIndent, node *BoundVariableDeclaration)
func WriteVariableExpression ¶
func WriteVariableExpression(w write.WriteIndent, node *BoundVariableExpression)
Types ¶
type BasicBlock ¶
type BasicBlock struct { IsStart bool IsEnd bool Statements []Boundstatement Incoming *DataMaps[BasicBlockBranch] Outgoing *DataMaps[BasicBlockBranch] }
func BuildBasicBlock ¶
func BuildBasicBlock(block *BoundBlockStatements) []*BasicBlock
func NewBasicBlock ¶
func NewBasicBlock(start bool, end bool) *BasicBlock
func (*BasicBlock) String ¶
func (b *BasicBlock) String() string
type BasicBlockBranch ¶
type BasicBlockBranch struct { From *BasicBlock To *BasicBlock Condition BoundExpression }
func (*BasicBlockBranch) String ¶
func (b *BasicBlockBranch) String() string
type Binder ¶
type Binder struct { Diagnostics *diagnostic.DiagnosticBag // contains filtered or unexported fields }
func NewBinder ¶
func NewBinder(parent *BoundScope, function *symbol.FunctionSymbol) *Binder
func (*Binder) BindAssignmentExpress ¶
func (b *Binder) BindAssignmentExpress(express *syntax.AssignmentExpress) BoundExpression
func (*Binder) BindBinaryOperator ¶
func (b *Binder) BindBinaryOperator(express *syntax.BinaryExpress) BoundExpression
func (*Binder) BindBlockStatement ¶
func (b *Binder) BindBlockStatement(s *syntax.BlockStatement) Boundstatement
func (*Binder) BindCallExpression ¶
func (b *Binder) BindCallExpression(express *syntax.CallExpress) BoundExpression
func (*Binder) BindExpression ¶
func (b *Binder) BindExpression(express syntax.Express, canBeUnit bool) BoundExpression
func (*Binder) BindExpressionAndCheckType ¶
func (b *Binder) BindExpressionAndCheckType(express syntax.Express, targetType *symbol.TypeSymbol) BoundExpression
func (*Binder) BindExpressionInternal ¶
func (b *Binder) BindExpressionInternal(express syntax.Express) BoundExpression
func (*Binder) BindExpressionStatement ¶
func (b *Binder) BindExpressionStatement(es *syntax.ExpressStatement) Boundstatement
func (*Binder) BindForStatement ¶
func (b *Binder) BindForStatement(s *syntax.ForStatement) Boundstatement
func (*Binder) BindFunctionDeclaration ¶
func (b *Binder) BindFunctionDeclaration(s *syntax.FunctionDeclarationSyntax)
func (*Binder) BindIfStatement ¶
func (b *Binder) BindIfStatement(s *syntax.IfStatement) Boundstatement
func (*Binder) BindLiteralExpress ¶
func (b *Binder) BindLiteralExpress(express *syntax.LiteralExpress) BoundExpression
func (*Binder) BindLoopBody ¶
func (b *Binder) BindLoopBody(body syntax.Statement) (res Boundstatement, breakLabel *BoundLabel, continueLabel *BoundLabel)
func (*Binder) BindNameExpress ¶
func (b *Binder) BindNameExpress(express *syntax.NameExpress) BoundExpression
func (*Binder) BindReturnStatement ¶
func (b *Binder) BindReturnStatement(s *syntax.ReturnStatement) Boundstatement
func (*Binder) BindStatement ¶
func (b *Binder) BindStatement(s syntax.Statement) Boundstatement
func (*Binder) BindTypeClause ¶
func (b *Binder) BindTypeClause(s *syntax.TypeClauseSyntax) *symbol.TypeSymbol
func (*Binder) BindUnaryExpress ¶
func (b *Binder) BindUnaryExpress(express *syntax.UnaryExpress) BoundExpression
func (*Binder) BindUnitExpression ¶
func (b *Binder) BindUnitExpression(express *syntax.UnitExpress) BoundExpression
func (*Binder) BindVariableDeclaration ¶
func (b *Binder) BindVariableDeclaration(s *syntax.VariableDeclarationSyntax) Boundstatement
func (*Binder) BindVariableSymbol ¶
func (b *Binder) BindVariableSymbol(identifier syntax.SyntaxToken, isReadOnly bool, tp *symbol.TypeSymbol) symbol.VariableSymbol
func (*Binder) BindWhileStatement ¶
func (b *Binder) BindWhileStatement(s *syntax.WhileStatement) Boundstatement
type BoundAssignmentExpression ¶
type BoundAssignmentExpression struct { Variable symbol.VariableSymbol Express BoundExpression }
func NewBoundAssignmentExpression ¶
func NewBoundAssignmentExpression(variable symbol.VariableSymbol, express BoundExpression) *BoundAssignmentExpression
func (*BoundAssignmentExpression) GetChildren ¶
func (b *BoundAssignmentExpression) GetChildren() []BoundNode
func (*BoundAssignmentExpression) GetProperties ¶
func (b *BoundAssignmentExpression) GetProperties() []fmt.Stringer
func (*BoundAssignmentExpression) Kind ¶
func (b *BoundAssignmentExpression) Kind() BoundNodeKind
func (*BoundAssignmentExpression) Type ¶
func (b *BoundAssignmentExpression) Type() *symbol.TypeSymbol
type BoundBinaryExpression ¶
type BoundBinaryExpression struct { Left BoundExpression Op *BoundBinaryOperator Right BoundExpression }
func NewBoundBinaryExpression ¶
func NewBoundBinaryExpression(left BoundExpression, op *BoundBinaryOperator, right BoundExpression) *BoundBinaryExpression
func (*BoundBinaryExpression) GetChildren ¶
func (b *BoundBinaryExpression) GetChildren() []BoundNode
func (*BoundBinaryExpression) GetProperties ¶
func (b *BoundBinaryExpression) GetProperties() []fmt.Stringer
func (*BoundBinaryExpression) Kind ¶
func (b *BoundBinaryExpression) Kind() BoundNodeKind
func (*BoundBinaryExpression) Type ¶
func (b *BoundBinaryExpression) Type() *symbol.TypeSymbol
type BoundBinaryOperator ¶
type BoundBinaryOperator struct { SyntaxKind syntax.SyntaxKind Kind BoundBinaryOperatorKind LeftType *symbol.TypeSymbol RightType *symbol.TypeSymbol Type *symbol.TypeSymbol }
func BindBoundBinaryOperator ¶
func BindBoundBinaryOperator(syntaxKind syntax.SyntaxKind, leftType, rightType *symbol.TypeSymbol) *BoundBinaryOperator
func (*BoundBinaryOperator) String ¶
func (b *BoundBinaryOperator) String() string
type BoundBinaryOperatorKind ¶
type BoundBinaryOperatorKind int
const ( BoundBinaryKindAddition BoundBinaryOperatorKind = iota BoundBinaryKindSubtraction BoundBinaryKindMultiplication BoundBinaryKindDivision BoundBinaryKindLogicalAnd BoundBinaryKindLogicalOr BoundBinaryKindBitwiseAnd BoundBinaryKindBitwiseOr BoundBinaryKindBitwiseXor BoundBinaryKindEquals BoundBinaryKindNotEquals BoundBinaryKindLess BoundBinaryKindLessEqual BoundBinaryKindGreat BoundBinaryKindGreatEqual BoundBinaryKindStringAdd BoundBinaryKindStringEqual BoundBinaryKindStringNotEqual )
func (BoundBinaryOperatorKind) String ¶
func (b BoundBinaryOperatorKind) String() string
type BoundBlockStatements ¶
type BoundBlockStatements struct {
Statement []Boundstatement
}
func NewBoundBlockStatement ¶
func NewBoundBlockStatement(statements []Boundstatement) *BoundBlockStatements
func (*BoundBlockStatements) GetChildren ¶
func (b *BoundBlockStatements) GetChildren() []BoundNode
func (*BoundBlockStatements) GetProperties ¶
func (b *BoundBlockStatements) GetProperties() []fmt.Stringer
func (*BoundBlockStatements) Kind ¶
func (b *BoundBlockStatements) Kind() BoundNodeKind
func (*BoundBlockStatements) Type ¶
func (b *BoundBlockStatements) Type() *symbol.TypeSymbol
type BoundCallExpression ¶
type BoundCallExpression struct { Function *symbol.FunctionSymbol Arguments []BoundExpression }
func NewBoundcallExpression ¶
func NewBoundcallExpression(function *symbol.FunctionSymbol, arguments []BoundExpression) *BoundCallExpression
func (*BoundCallExpression) GetChildren ¶
func (b *BoundCallExpression) GetChildren() []BoundNode
func (*BoundCallExpression) GetProperties ¶
func (b *BoundCallExpression) GetProperties() []fmt.Stringer
func (*BoundCallExpression) Kind ¶
func (b *BoundCallExpression) Kind() BoundNodeKind
func (*BoundCallExpression) Type ¶
func (b *BoundCallExpression) Type() *symbol.TypeSymbol
type BoundErrorExpression ¶
type BoundErrorExpression struct { }
func NewBoundErrorExpression ¶
func NewBoundErrorExpression() *BoundErrorExpression
func (*BoundErrorExpression) GetChildren ¶
func (b *BoundErrorExpression) GetChildren() []BoundNode
func (*BoundErrorExpression) GetProperties ¶
func (b *BoundErrorExpression) GetProperties() []fmt.Stringer
func (*BoundErrorExpression) Kind ¶
func (b *BoundErrorExpression) Kind() BoundNodeKind
func (*BoundErrorExpression) Type ¶
func (b *BoundErrorExpression) Type() *symbol.TypeSymbol
type BoundExpressStatements ¶
type BoundExpressStatements struct {
Express BoundExpression
}
func NewBoundExpressStatements ¶
func NewBoundExpressStatements(express BoundExpression) *BoundExpressStatements
func (*BoundExpressStatements) GetChildren ¶
func (b *BoundExpressStatements) GetChildren() []BoundNode
func (*BoundExpressStatements) GetProperties ¶
func (b *BoundExpressStatements) GetProperties() []fmt.Stringer
func (*BoundExpressStatements) Kind ¶
func (b *BoundExpressStatements) Kind() BoundNodeKind
func (*BoundExpressStatements) Type ¶
func (b *BoundExpressStatements) Type() *symbol.TypeSymbol
type BoundExpression ¶
type BoundExpression interface { BoundNode }
type BoundForStatements ¶
type BoundForStatements struct { BoundLoopStatements InitCondition Boundstatement EndCheckConditionExpress BoundExpression //must be bool UpdateCondition Boundstatement Body Boundstatement }
func NewBoundForStatements ¶
func NewBoundForStatements(initCondition Boundstatement, endCondition BoundExpression, updateCondition Boundstatement, body Boundstatement, breakLabel *BoundLabel, continueLabel *BoundLabel) *BoundForStatements
func (*BoundForStatements) GetChildren ¶
func (b *BoundForStatements) GetChildren() []BoundNode
func (*BoundForStatements) GetProperties ¶
func (b *BoundForStatements) GetProperties() []fmt.Stringer
func (*BoundForStatements) Kind ¶
func (b *BoundForStatements) Kind() BoundNodeKind
func (*BoundForStatements) Type ¶
func (b *BoundForStatements) Type() *symbol.TypeSymbol
type BoundGlobalScope ¶
type BoundGlobalScope struct { Previous *BoundGlobalScope Diagnostic *diagnostic.DiagnosticBag Functions []*symbol.FunctionSymbol Variables []symbol.VariableSymbol Statements []Boundstatement }
func BindGlobalScope ¶
func BindGlobalScope(previous *BoundGlobalScope, s *syntax.CompliationUnit) *BoundGlobalScope
func NewBoundGlobalScope ¶
func NewBoundGlobalScope(previous *BoundGlobalScope, diagnostic *diagnostic.DiagnosticBag, functions []*symbol.FunctionSymbol, variables []symbol.VariableSymbol, statements []Boundstatement) *BoundGlobalScope
type BoundIfStatements ¶
type BoundIfStatements struct { Condition BoundExpression ThenStatement Boundstatement ElseStatement Boundstatement }
func NewBoundIfStatements ¶
func NewBoundIfStatements(condition BoundExpression, thenStatement, elseStatement Boundstatement) *BoundIfStatements
func (*BoundIfStatements) GetChildren ¶
func (b *BoundIfStatements) GetChildren() []BoundNode
func (*BoundIfStatements) GetProperties ¶
func (b *BoundIfStatements) GetProperties() []fmt.Stringer
func (*BoundIfStatements) Kind ¶
func (b *BoundIfStatements) Kind() BoundNodeKind
func (*BoundIfStatements) Type ¶
func (b *BoundIfStatements) Type() *symbol.TypeSymbol
type BoundLabel ¶
type BoundLabel struct {
Name string
}
func NewBoundLabel ¶
func NewBoundLabel(name string) *BoundLabel
func (*BoundLabel) String ¶
func (l *BoundLabel) String() string
type BoundLiteralExpression ¶
type BoundLiteralExpression struct {
Value any
}
func NewBoundLiteralExpression ¶
func NewBoundLiteralExpression(value any) *BoundLiteralExpression
func (*BoundLiteralExpression) GetChildren ¶
func (b *BoundLiteralExpression) GetChildren() []BoundNode
func (*BoundLiteralExpression) GetProperties ¶
func (b *BoundLiteralExpression) GetProperties() []fmt.Stringer
func (*BoundLiteralExpression) Kind ¶
func (b *BoundLiteralExpression) Kind() BoundNodeKind
func (*BoundLiteralExpression) Type ¶
func (b *BoundLiteralExpression) Type() *symbol.TypeSymbol
type BoundLoopStatements ¶
type BoundLoopStatements struct { BreakLabel *BoundLabel ContinueLabel *BoundLabel }
func NewBoundLoopStatements ¶
func NewBoundLoopStatements(breakLabel *BoundLabel, continueLabel *BoundLabel) *BoundLoopStatements
type BoundNode ¶
type BoundNode interface { Type() *symbol.TypeSymbol Kind() BoundNodeKind NodePrint }
type BoundNodeKind ¶
type BoundNodeKind int
const ( BoundNodeKindErrorExpress BoundNodeKind = iota BoundNodeKindLiteralExpress BoundNodeKindVariableExpress BoundNodeKindAssignmentExpress BoundNodeKindUnaryExpress BoundNodeKindBinaryExpress BoundNodeKindCallExpress BoundNodeKindUnitExpress BoundNodeKindBlockStatement BoundNodeKindVariableDeclaration BoundNodeKindIfStatement BoundNodeKindWhileStatement BoundNodeKindForStatement BoundNodeKindLabelStatement BoundNodeKindGotoStatement BoundNodeKindConditionalGotoStatement BoundNodeKindReturnStatement BoundNodeKindExpressionStatement )
func (BoundNodeKind) String ¶
func (b BoundNodeKind) String() string
type BoundReturnStatements ¶
type BoundReturnStatements struct {
Express BoundExpression
}
func NewBoundReturnStatements ¶
func NewBoundReturnStatements(express BoundExpression) *BoundReturnStatements
func (*BoundReturnStatements) GetChildren ¶
func (b *BoundReturnStatements) GetChildren() []BoundNode
func (*BoundReturnStatements) GetProperties ¶
func (b *BoundReturnStatements) GetProperties() []fmt.Stringer
func (*BoundReturnStatements) Kind ¶
func (b *BoundReturnStatements) Kind() BoundNodeKind
func (*BoundReturnStatements) Type ¶
func (b *BoundReturnStatements) Type() *symbol.TypeSymbol
type BoundScope ¶
type BoundScope struct { Parent *BoundScope // contains filtered or unexported fields }
func CreateParentScope ¶
func CreateParentScope(previous *BoundGlobalScope) *BoundScope
func CreateRootScope ¶
func CreateRootScope() *BoundScope
func NewBoundScope ¶
func NewBoundScope(parent *BoundScope) *BoundScope
func (*BoundScope) GetDeclareFunctions ¶
func (s *BoundScope) GetDeclareFunctions() []*symbol.FunctionSymbol
func (*BoundScope) GetDeclareVariables ¶
func (s *BoundScope) GetDeclareVariables() []symbol.VariableSymbol
func (*BoundScope) TryDeclareFunction ¶
func (s *BoundScope) TryDeclareFunction(function *symbol.FunctionSymbol) bool
func (*BoundScope) TryDeclareVariable ¶
func (s *BoundScope) TryDeclareVariable(variable symbol.VariableSymbol) bool
func (*BoundScope) TryLookupFunction ¶
func (s *BoundScope) TryLookupFunction(name string) (*symbol.FunctionSymbol, bool)
func (*BoundScope) TryLookupVariable ¶
func (s *BoundScope) TryLookupVariable(name string) (symbol.VariableSymbol, bool)
type BoundUnaryExpression ¶
type BoundUnaryExpression struct { Op *BoundUnaryOperator Operand BoundExpression }
func NewBoundUnaryExpression ¶
func NewBoundUnaryExpression(op *BoundUnaryOperator, operand BoundExpression) *BoundUnaryExpression
func (*BoundUnaryExpression) GetChildren ¶
func (b *BoundUnaryExpression) GetChildren() []BoundNode
func (*BoundUnaryExpression) GetProperties ¶
func (b *BoundUnaryExpression) GetProperties() []fmt.Stringer
func (*BoundUnaryExpression) Kind ¶
func (b *BoundUnaryExpression) Kind() BoundNodeKind
func (*BoundUnaryExpression) Type ¶
func (b *BoundUnaryExpression) Type() *symbol.TypeSymbol
type BoundUnaryOperator ¶
type BoundUnaryOperator struct { Kind BoundUnaryOperatorKind // contains filtered or unexported fields }
func BindBoundUnaryOperator ¶
func BindBoundUnaryOperator(syntaxKind syntax.SyntaxKind, operandType *symbol.TypeSymbol) *BoundUnaryOperator
func (*BoundUnaryOperator) String ¶
func (b *BoundUnaryOperator) String() string
type BoundUnaryOperatorKind ¶
type BoundUnaryOperatorKind int
const ( BoundUnaryOperatorKindIdentity BoundUnaryOperatorKind = iota BoundUnaryOperatorKindNegation BoundUnaryOperatorKindLogicalNegation BoundUnaryOperatorKindBitwiseOnesComplement )
type BoundUnitExpression ¶
type BoundUnitExpression struct {
Unit *syntax.UnitExpress
}
func NewBoundUnitExpression ¶
func NewBoundUnitExpression(unit *syntax.UnitExpress) *BoundUnitExpression
func (*BoundUnitExpression) GetChildren ¶
func (b *BoundUnitExpression) GetChildren() []BoundNode
func (*BoundUnitExpression) GetProperties ¶
func (b *BoundUnitExpression) GetProperties() []fmt.Stringer
func (*BoundUnitExpression) Kind ¶
func (b *BoundUnitExpression) Kind() BoundNodeKind
func (*BoundUnitExpression) Type ¶
func (b *BoundUnitExpression) Type() *symbol.TypeSymbol
type BoundVariableDeclaration ¶
type BoundVariableDeclaration struct { Variable symbol.VariableSymbol Initializer BoundExpression }
func NewBoundVariableDeclaration ¶
func NewBoundVariableDeclaration(variable symbol.VariableSymbol, initializer BoundExpression) *BoundVariableDeclaration
func (*BoundVariableDeclaration) GetChildren ¶
func (b *BoundVariableDeclaration) GetChildren() []BoundNode
func (*BoundVariableDeclaration) GetProperties ¶
func (b *BoundVariableDeclaration) GetProperties() []fmt.Stringer
func (*BoundVariableDeclaration) Kind ¶
func (b *BoundVariableDeclaration) Kind() BoundNodeKind
func (*BoundVariableDeclaration) Type ¶
func (b *BoundVariableDeclaration) Type() *symbol.TypeSymbol
type BoundVariableExpression ¶
type BoundVariableExpression struct {
Variable symbol.VariableSymbol
}
func NewBoundVariableExpression ¶
func NewBoundVariableExpression(variable symbol.VariableSymbol) *BoundVariableExpression
func (*BoundVariableExpression) GetChildren ¶
func (b *BoundVariableExpression) GetChildren() []BoundNode
func (*BoundVariableExpression) GetProperties ¶
func (b *BoundVariableExpression) GetProperties() []fmt.Stringer
func (*BoundVariableExpression) Kind ¶
func (b *BoundVariableExpression) Kind() BoundNodeKind
func (*BoundVariableExpression) Type ¶
func (b *BoundVariableExpression) Type() *symbol.TypeSymbol
type BoundWhileStatements ¶
type BoundWhileStatements struct { BoundLoopStatements Condition BoundExpression Body Boundstatement }
func NewBoundWhileStatements ¶
func NewBoundWhileStatements(condition BoundExpression, body Boundstatement, breakLabel *BoundLabel, continueLabel *BoundLabel) *BoundWhileStatements
func (*BoundWhileStatements) GetChildren ¶
func (b *BoundWhileStatements) GetChildren() []BoundNode
func (*BoundWhileStatements) GetProperties ¶
func (b *BoundWhileStatements) GetProperties() []fmt.Stringer
func (*BoundWhileStatements) Kind ¶
func (b *BoundWhileStatements) Kind() BoundNodeKind
func (*BoundWhileStatements) Type ¶
func (b *BoundWhileStatements) Type() *symbol.TypeSymbol
type Boundstatement ¶
type Boundstatement interface { BoundNode }
func BindErrorStatement ¶
func BindErrorStatement() Boundstatement
type ConditionalGotoStatement ¶
type ConditionalGotoStatement struct { Label *BoundLabel Condition BoundExpression JumpIfFalse bool }
func NewConditionalGotoSymbol ¶
func NewConditionalGotoSymbol(label *BoundLabel, condition BoundExpression, jumpIfFalse bool) *ConditionalGotoStatement
func (*ConditionalGotoStatement) GetChildren ¶
func (b *ConditionalGotoStatement) GetChildren() []BoundNode
func (*ConditionalGotoStatement) GetProperties ¶
func (b *ConditionalGotoStatement) GetProperties() []fmt.Stringer
func (*ConditionalGotoStatement) Kind ¶
func (b *ConditionalGotoStatement) Kind() BoundNodeKind
func (*ConditionalGotoStatement) Type ¶
func (b *ConditionalGotoStatement) Type() *symbol.TypeSymbol
type ControlFlowGraph ¶
type ControlFlowGraph struct { Start *BasicBlock End *BasicBlock Blocks *DataMaps[BasicBlock] Branches *DataMaps[BasicBlockBranch] }
func CreateControlFlow ¶
func CreateControlFlow(body *BoundBlockStatements) *ControlFlowGraph
func (*ControlFlowGraph) WriteTo ¶
func (g *ControlFlowGraph) WriteTo(w *strings.Builder)
type DataMaps ¶
func DataMapsFromSlice ¶
func NewDataMaps ¶
func (*DataMaps[T]) Iter ¶
func (b *DataMaps[T]) Iter() *DataMapsIter[T]
type DataMapsIter ¶
func (*DataMapsIter[T]) HasNext ¶
func (d *DataMapsIter[T]) HasNext() bool
func (*DataMapsIter[T]) Next ¶
func (d *DataMapsIter[T]) Next() *T
type GotoStatement ¶
type GotoStatement struct {
Label *BoundLabel
}
func NewGotoSymbol ¶
func NewGotoSymbol(label *BoundLabel) *GotoStatement
func (*GotoStatement) GetChildren ¶
func (b *GotoStatement) GetChildren() []BoundNode
func (*GotoStatement) GetProperties ¶
func (b *GotoStatement) GetProperties() []fmt.Stringer
func (*GotoStatement) Kind ¶
func (b *GotoStatement) Kind() BoundNodeKind
func (*GotoStatement) Type ¶
func (b *GotoStatement) Type() *symbol.TypeSymbol
type GraphBuilder ¶
type GraphBuilder struct {
// contains filtered or unexported fields
}
func NewGraphBuild ¶
func NewGraphBuild() *GraphBuilder
func (*GraphBuilder) Build ¶
func (g *GraphBuilder) Build(blocks *DataMaps[BasicBlock]) *ControlFlowGraph
func (*GraphBuilder) Connect ¶
func (g *GraphBuilder) Connect(from, to *BasicBlock, condition BoundExpression)
func (*GraphBuilder) Negate ¶
func (g *GraphBuilder) Negate(condition BoundExpression) BoundExpression
func (*GraphBuilder) RemoveBlock ¶
func (g *GraphBuilder) RemoveBlock(blocks *DataMaps[BasicBlock], block *BasicBlock)
type LabelStatement ¶
type LabelStatement struct {
Label *BoundLabel
}
func NewLabelSymbol ¶
func NewLabelSymbol(label *BoundLabel) *LabelStatement
func (*LabelStatement) GetChildren ¶
func (b *LabelStatement) GetChildren() []BoundNode
func (*LabelStatement) GetProperties ¶
func (b *LabelStatement) GetProperties() []fmt.Stringer
func (*LabelStatement) Kind ¶
func (b *LabelStatement) Kind() BoundNodeKind
func (*LabelStatement) Type ¶
func (b *LabelStatement) Type() *symbol.TypeSymbol
Source Files ¶
- bind.go
- bound_assignment_expression.go
- bound_binary_expression.go
- bound_binary_operator.go
- bound_block_statement.go
- bound_call_expression.go
- bound_error_expression.go
- bound_express_statement.go
- bound_expression.go
- bound_for_statement.go
- bound_global_scope.go
- bound_if_statement.go
- bound_literal_expression.go
- bound_loop_statement.go
- bound_node.go
- bound_node_printer.go
- bound_return_statement.go
- bound_scope.go
- bound_unary_expression.go
- bound_unary_operator.go
- bound_unit_expression.go
- bound_variable_declaration.go
- bound_variable_expression.go
- bound_while_statement.go
- build_graph.go
- conditional_goto_statement.go
- goto_statement.go
- label_statement.go
- label_symbol.go
Click to show internal directories.
Click to hide internal directories.