Documentation ¶
Index ¶
- Variables
- func FailClassLookup(name string, canFail bool, errorLocation print.TextSpan) (symbols.ClassSymbol, bool)
- func FailPackageLookup(name string, canFail bool, errorLocation print.TextSpan) (symbols.PackageSymbol, bool)
- func FailStructLookup(name string, canFail bool, errorLocation print.TextSpan) (symbols.StructSymbol, bool)
- func LookupClassInPackage(name string, pack symbols.PackageSymbol, canFail bool, ...) (symbols.ClassSymbol, bool)
- func LookupFunctionInPackage(name string, pack symbols.PackageSymbol, canFail bool, ...) (symbols.FunctionSymbol, bool)
- func LookupPrimitiveType(name string, canFail bool, errorLocation print.TextSpan) (symbols.TypeSymbol, bool)
- type Binder
- func (bin *Binder) BindArrayAccessExpression(expr nodes.ArrayAccessExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindArrayAssignmentExpression(expr nodes.ArrayAssignmentExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindAssignmentExpression(expr nodes.AssignmentExpressionNode) boundnodes.BoundAssignmentExpressionNode
- func (bin *Binder) BindBinaryExpression(expr nodes.BinaryExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindBinaryExpressionInternal(expr nodes.SyntaxNode, left boundnodes.BoundExpressionNode, ...) boundnodes.BoundExpressionNode
- func (bin *Binder) BindBlockStatement(stmt nodes.BlockStatementNode) boundnodes.BoundBlockStatementNode
- func (bin *Binder) BindBreakStatement(stmt nodes.BreakStatementNode) boundnodes.BoundStatementNode
- func (bin *Binder) BindCallExpression(expr nodes.CallExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindClassCallExpression(expr nodes.TypeCallExpressionNode, ...) boundnodes.BoundExpressionNode
- func (bin *Binder) BindClassDeclaration(mem nodes.ClassDeclarationMember, preInitialTypeset []symbols.TypeSymbol)
- func (bin *Binder) BindClassFieldAccessExpression(expr nodes.ClassFieldAccessExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindClassFieldAssignmentExpression(expr nodes.ClassFieldAssignmentExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindContinueStatement(stmt nodes.ContinueStatementNode) boundnodes.BoundStatementNode
- func (bin *Binder) BindConversion(expr boundnodes.BoundExpressionNode, to symbols.TypeSymbol, allowExplicit bool, ...) boundnodes.BoundExpressionNode
- func (bin *Binder) BindDereferenceExpression(expr nodes.DereferenceExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindElseClause(clause nodes.ElseClauseNode) boundnodes.BoundStatementNode
- func (bin *Binder) BindEnumDeclaration(mem nodes.EnumDeclarationMember)
- func (bin *Binder) BindExpression(expr nodes.ExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindExpressionStatement(stmt nodes.ExpressionStatementNode) boundnodes.BoundExpressionStatementNode
- func (bin *Binder) BindExternalFunctionDeclaration(mem nodes.ExternalFunctionDeclarationMember, inClass bool)
- func (bin *Binder) BindForStatement(stmt nodes.ForStatementNode) boundnodes.BoundStatementNode
- func (bin *Binder) BindFromToStatement(stmt nodes.FromToStatementNode) boundnodes.BoundStatementNode
- func (bin *Binder) BindFunctionDeclaration(mem nodes.FunctionDeclarationMember, inClass bool)
- func (bin *Binder) BindIfStatement(stmt nodes.IfStatementNode) boundnodes.BoundIfStatementNode
- func (bin *Binder) BindLambdaExpression(expr nodes.LambdaExpressionNode) boundnodes.BoundLambdaExpressionNode
- func (bin *Binder) BindLiteralExpression(expr nodes.LiteralExpressionNode) boundnodes.BoundLiteralExpressionNode
- func (bin *Binder) BindLoopBody(stmt nodes.StatementNode) (boundnodes.BoundStatementNode, boundnodes.BoundLabel, boundnodes.BoundLabel)
- func (bin *Binder) BindMakeArrayExpression(expr nodes.MakeArrayExpressionNode) boundnodes.BoundMakeArrayExpressionNode
- func (bin *Binder) BindMakeExpression(expr nodes.MakeExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindMakeStructExpression(expr nodes.MakeStructExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindNameExpression(expr nodes.NameExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindPackageAlias(mem nodes.PackageAliasMember)
- func (bin *Binder) BindPackageCallExpression(expr nodes.PackageCallExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindPackageReference(mem nodes.PackageReferenceMember)
- func (bin *Binder) BindPackageUse(mem nodes.PackageUseMember)
- func (bin *Binder) BindParenthesisedExpression(expr nodes.ParenthesisedExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindReferenceExpression(expr nodes.ReferenceExpressionNode) boundnodes.BoundReferenceExpressionNode
- func (bin *Binder) BindReturnStatement(stmt nodes.ReturnStatementNode) boundnodes.BoundStatementNode
- func (bin *Binder) BindStatement(stmt nodes.StatementNode) boundnodes.BoundStatementNode
- func (bin *Binder) BindStatementInternal(stmt nodes.StatementNode) boundnodes.BoundStatementNode
- func (bin *Binder) BindStructDeclaration(mem nodes.StructDeclarationMember, preInitialTypeset []symbols.TypeSymbol)
- func (bin *Binder) BindTernaryExpression(expr nodes.TernaryExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindThisExpression(expr nodes.ThisExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindTypeCallExpression(expr nodes.TypeCallExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindTypeClause(tc nodes.TypeClauseNode) (symbols.TypeSymbol, bool)
- func (bin *Binder) BindUnaryExpression(expr nodes.UnaryExpressionNode) boundnodes.BoundExpressionNode
- func (bin *Binder) BindVariableCreation(id lexer.Token, isReadOnly bool, isGlobal bool, varType symbols.TypeSymbol) symbols.VariableSymbol
- func (bin *Binder) BindVariableDeclaration(stmt nodes.VariableDeclarationStatementNode) boundnodes.BoundStatementNode
- func (bin *Binder) BindVariableEditorExpression(expr nodes.VariableEditorExpressionNode) boundnodes.BoundAssignmentExpressionNode
- func (bin *Binder) BindVariableReference(name string, errorLocation print.TextSpan, inMain bool) symbols.VariableSymbol
- func (bin *Binder) BindWhileStatement(stmt nodes.WhileStatementNode) boundnodes.BoundWhileStatementNode
- func (bin *Binder) GetLabels() (boundnodes.BoundLabel, boundnodes.BoundLabel)
- func (bin Binder) LookupClass(name string, canFail bool, errorLocaton print.TextSpan) (symbols.ClassSymbol, bool)
- func (bin *Binder) LookupClassField(name string, baseType symbols.TypeSymbol, errorLocation print.TextSpan) symbols.VariableSymbol
- func (bin *Binder) LookupClassFunction(name string, baseType symbols.TypeSymbol, errorLocation print.TextSpan) symbols.FunctionSymbol
- func (bin Binder) LookupEnum(name string) (symbols.EnumSymbol, bool)
- func (bin Binder) LookupPackage(name string, canFail bool, errorLocaton print.TextSpan) (symbols.PackageSymbol, bool)
- func (bin Binder) LookupStruct(name string, canFail bool, errorLocaton print.TextSpan) (symbols.StructSymbol, bool)
- func (bin *Binder) LookupStructField(name string, baseType symbols.TypeSymbol, errorLocation print.TextSpan) symbols.VariableSymbol
- func (bin Binder) LookupType(typeClause nodes.TypeClauseNode, canFail bool) (symbols.TypeSymbol, bool)
- func (bin *Binder) LookupTypeFunction(name string, baseType symbols.TypeSymbol, errorLocation print.TextSpan) symbols.TypeFunctionSymbol
- func (bin *Binder) PopLabels()
- func (bin *Binder) PopScope()
- func (bin *Binder) PushLabels(breakLabel boundnodes.BoundLabel, continueLabel boundnodes.BoundLabel)
- func (bin *Binder) PushScope(s Scope)
- type BoundClass
- type BoundFunction
- type BoundProgram
- type Conversion
- type GlobalScope
- type Scope
- func (s Scope) GetAllClasses() []symbols.ClassSymbol
- func (s Scope) GetAllFunctions() []symbols.FunctionSymbol
- func (s Scope) GetAllPackages() []symbols.PackageSymbol
- func (s Scope) GetAllStructs() []symbols.StructSymbol
- func (s Scope) GetAllVariables() []symbols.VariableSymbol
- func (s Scope) InsertFunctionSymbols(symbols []symbols.FunctionSymbol)
- func (s Scope) InsertVariableSymbols(symbols []symbols.VariableSymbol)
- func (s *Scope) TryDeclareSymbol(sym symbols.Symbol) bool
- func (s Scope) TryLookupSymbol(name string) symbols.Symbol
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NoConversion = CreateConvertion(false, false, false) // conversion impossible / not allowed IdentityConversion = CreateConvertion(true, true, true) // no conversion needed ImplicitConversion = CreateConvertion(true, false, true) // automatic conversion ExplicitConversion = CreateConvertion(true, false, false) // conversion will need to be explicitly specified by the user )
conversion types
View Source
var PackageUseList []symbols.PackageSymbol
Functions ¶
func FailClassLookup ¶
func FailPackageLookup ¶
func FailStructLookup ¶
func LookupClassInPackage ¶
func LookupClassInPackage(name string, pack symbols.PackageSymbol, canFail bool, errorLocation print.TextSpan) (symbols.ClassSymbol, bool)
func LookupFunctionInPackage ¶
func LookupFunctionInPackage(name string, pack symbols.PackageSymbol, canFail bool, errorLocation print.TextSpan) (symbols.FunctionSymbol, bool)
func LookupPrimitiveType ¶
Types ¶
type Binder ¶
type Binder struct { MemberScope Scope Scopes []Scope ActiveScope *Scope FunctionSymbol symbols.FunctionSymbol ClassSymbol symbols.ClassSymbol LabelCounter int BreakLabels []boundnodes.BoundLabel ContinueLabels []boundnodes.BoundLabel PreInitialTypeset []symbols.TypeSymbol InClass bool }
func CreateBinder ¶
func CreateBinder(parent Scope, functionSymbol symbols.FunctionSymbol) *Binder
constructor
func (*Binder) BindArrayAccessExpression ¶
func (bin *Binder) BindArrayAccessExpression(expr nodes.ArrayAccessExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindArrayAssignmentExpression ¶
func (bin *Binder) BindArrayAssignmentExpression(expr nodes.ArrayAssignmentExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindAssignmentExpression ¶
func (bin *Binder) BindAssignmentExpression(expr nodes.AssignmentExpressionNode) boundnodes.BoundAssignmentExpressionNode
func (*Binder) BindBinaryExpression ¶
func (bin *Binder) BindBinaryExpression(expr nodes.BinaryExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindBinaryExpressionInternal ¶
func (bin *Binder) BindBinaryExpressionInternal(expr nodes.SyntaxNode, left boundnodes.BoundExpressionNode, right boundnodes.BoundExpressionNode, opkind lexer.TokenKind) boundnodes.BoundExpressionNode
func (*Binder) BindBlockStatement ¶
func (bin *Binder) BindBlockStatement(stmt nodes.BlockStatementNode) boundnodes.BoundBlockStatementNode
func (*Binder) BindBreakStatement ¶
func (bin *Binder) BindBreakStatement(stmt nodes.BreakStatementNode) boundnodes.BoundStatementNode
func (*Binder) BindCallExpression ¶
func (bin *Binder) BindCallExpression(expr nodes.CallExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindClassCallExpression ¶
func (bin *Binder) BindClassCallExpression(expr nodes.TypeCallExpressionNode, baseExpression boundnodes.BoundExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindClassDeclaration ¶
func (bin *Binder) BindClassDeclaration(mem nodes.ClassDeclarationMember, preInitialTypeset []symbols.TypeSymbol)
func (*Binder) BindClassFieldAccessExpression ¶
func (bin *Binder) BindClassFieldAccessExpression(expr nodes.ClassFieldAccessExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindClassFieldAssignmentExpression ¶
func (bin *Binder) BindClassFieldAssignmentExpression(expr nodes.ClassFieldAssignmentExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindContinueStatement ¶
func (bin *Binder) BindContinueStatement(stmt nodes.ContinueStatementNode) boundnodes.BoundStatementNode
func (*Binder) BindConversion ¶
func (bin *Binder) BindConversion(expr boundnodes.BoundExpressionNode, to symbols.TypeSymbol, allowExplicit bool, errorLocation print.TextSpan) boundnodes.BoundExpressionNode
func (*Binder) BindDereferenceExpression ¶
func (bin *Binder) BindDereferenceExpression(expr nodes.DereferenceExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindElseClause ¶
func (bin *Binder) BindElseClause(clause nodes.ElseClauseNode) boundnodes.BoundStatementNode
func (*Binder) BindEnumDeclaration ¶
func (bin *Binder) BindEnumDeclaration(mem nodes.EnumDeclarationMember)
func (*Binder) BindExpression ¶
func (bin *Binder) BindExpression(expr nodes.ExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindExpressionStatement ¶
func (bin *Binder) BindExpressionStatement(stmt nodes.ExpressionStatementNode) boundnodes.BoundExpressionStatementNode
func (*Binder) BindExternalFunctionDeclaration ¶
func (bin *Binder) BindExternalFunctionDeclaration(mem nodes.ExternalFunctionDeclarationMember, inClass bool)
func (*Binder) BindForStatement ¶
func (bin *Binder) BindForStatement(stmt nodes.ForStatementNode) boundnodes.BoundStatementNode
func (*Binder) BindFromToStatement ¶
func (bin *Binder) BindFromToStatement(stmt nodes.FromToStatementNode) boundnodes.BoundStatementNode
func (*Binder) BindFunctionDeclaration ¶
func (bin *Binder) BindFunctionDeclaration(mem nodes.FunctionDeclarationMember, inClass bool)
func (*Binder) BindIfStatement ¶
func (bin *Binder) BindIfStatement(stmt nodes.IfStatementNode) boundnodes.BoundIfStatementNode
func (*Binder) BindLambdaExpression ¶
func (bin *Binder) BindLambdaExpression(expr nodes.LambdaExpressionNode) boundnodes.BoundLambdaExpressionNode
func (*Binder) BindLiteralExpression ¶
func (bin *Binder) BindLiteralExpression(expr nodes.LiteralExpressionNode) boundnodes.BoundLiteralExpressionNode
func (*Binder) BindLoopBody ¶
func (bin *Binder) BindLoopBody(stmt nodes.StatementNode) (boundnodes.BoundStatementNode, boundnodes.BoundLabel, boundnodes.BoundLabel)
func (*Binder) BindMakeArrayExpression ¶
func (bin *Binder) BindMakeArrayExpression(expr nodes.MakeArrayExpressionNode) boundnodes.BoundMakeArrayExpressionNode
func (*Binder) BindMakeExpression ¶
func (bin *Binder) BindMakeExpression(expr nodes.MakeExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindMakeStructExpression ¶
func (bin *Binder) BindMakeStructExpression(expr nodes.MakeStructExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindNameExpression ¶
func (bin *Binder) BindNameExpression(expr nodes.NameExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindPackageAlias ¶
func (bin *Binder) BindPackageAlias(mem nodes.PackageAliasMember)
func (*Binder) BindPackageCallExpression ¶
func (bin *Binder) BindPackageCallExpression(expr nodes.PackageCallExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindPackageReference ¶
func (bin *Binder) BindPackageReference(mem nodes.PackageReferenceMember)
func (*Binder) BindPackageUse ¶
func (bin *Binder) BindPackageUse(mem nodes.PackageUseMember)
func (*Binder) BindParenthesisedExpression ¶
func (bin *Binder) BindParenthesisedExpression(expr nodes.ParenthesisedExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindReferenceExpression ¶
func (bin *Binder) BindReferenceExpression(expr nodes.ReferenceExpressionNode) boundnodes.BoundReferenceExpressionNode
func (*Binder) BindReturnStatement ¶
func (bin *Binder) BindReturnStatement(stmt nodes.ReturnStatementNode) boundnodes.BoundStatementNode
func (*Binder) BindStatement ¶
func (bin *Binder) BindStatement(stmt nodes.StatementNode) boundnodes.BoundStatementNode
</MEMBERS> ---------------------------------------------------------------- <STATEMENTS> ---------------------------------------------------------------
func (*Binder) BindStatementInternal ¶
func (bin *Binder) BindStatementInternal(stmt nodes.StatementNode) boundnodes.BoundStatementNode
func (*Binder) BindStructDeclaration ¶
func (bin *Binder) BindStructDeclaration(mem nodes.StructDeclarationMember, preInitialTypeset []symbols.TypeSymbol)
func (*Binder) BindTernaryExpression ¶
func (bin *Binder) BindTernaryExpression(expr nodes.TernaryExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindThisExpression ¶
func (bin *Binder) BindThisExpression(expr nodes.ThisExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindTypeCallExpression ¶
func (bin *Binder) BindTypeCallExpression(expr nodes.TypeCallExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindTypeClause ¶
func (bin *Binder) BindTypeClause(tc nodes.TypeClauseNode) (symbols.TypeSymbol, bool)
func (*Binder) BindUnaryExpression ¶
func (bin *Binder) BindUnaryExpression(expr nodes.UnaryExpressionNode) boundnodes.BoundExpressionNode
func (*Binder) BindVariableCreation ¶
func (bin *Binder) BindVariableCreation(id lexer.Token, isReadOnly bool, isGlobal bool, varType symbols.TypeSymbol) symbols.VariableSymbol
func (*Binder) BindVariableDeclaration ¶
func (bin *Binder) BindVariableDeclaration(stmt nodes.VariableDeclarationStatementNode) boundnodes.BoundStatementNode
func (*Binder) BindVariableEditorExpression ¶
func (bin *Binder) BindVariableEditorExpression(expr nodes.VariableEditorExpressionNode) boundnodes.BoundAssignmentExpressionNode
func (*Binder) BindVariableReference ¶
func (*Binder) BindWhileStatement ¶
func (bin *Binder) BindWhileStatement(stmt nodes.WhileStatementNode) boundnodes.BoundWhileStatementNode
func (*Binder) GetLabels ¶
func (bin *Binder) GetLabels() (boundnodes.BoundLabel, boundnodes.BoundLabel)
func (Binder) LookupClass ¶
func (*Binder) LookupClassField ¶
func (bin *Binder) LookupClassField(name string, baseType symbols.TypeSymbol, errorLocation print.TextSpan) symbols.VariableSymbol
func (*Binder) LookupClassFunction ¶
func (bin *Binder) LookupClassFunction(name string, baseType symbols.TypeSymbol, errorLocation print.TextSpan) symbols.FunctionSymbol
func (Binder) LookupEnum ¶
func (bin Binder) LookupEnum(name string) (symbols.EnumSymbol, bool)
func (Binder) LookupPackage ¶
func (Binder) LookupStruct ¶
func (*Binder) LookupStructField ¶
func (bin *Binder) LookupStructField(name string, baseType symbols.TypeSymbol, errorLocation print.TextSpan) symbols.VariableSymbol
func (Binder) LookupType ¶
func (bin Binder) LookupType(typeClause nodes.TypeClauseNode, canFail bool) (symbols.TypeSymbol, bool)
func (*Binder) LookupTypeFunction ¶
func (bin *Binder) LookupTypeFunction(name string, baseType symbols.TypeSymbol, errorLocation print.TextSpan) symbols.TypeFunctionSymbol
func (*Binder) PushLabels ¶
func (bin *Binder) PushLabels(breakLabel boundnodes.BoundLabel, continueLabel boundnodes.BoundLabel)
helpers for the label stacks
type BoundClass ¶
type BoundClass struct { Symbol symbols.ClassSymbol Functions []BoundFunction }
type BoundFunction ¶
type BoundFunction struct { Symbol symbols.FunctionSymbol Body boundnodes.BoundBlockStatementNode }
type BoundProgram ¶
type BoundProgram struct { GlobalScope *GlobalScope MainFunction symbols.FunctionSymbol Functions []BoundFunction ExternalFunctions []symbols.FunctionSymbol Classes []BoundClass Structs []symbols.StructSymbol Packages []symbols.PackageSymbol }
func BindProgram ¶
func BindProgram(members []nodes.MemberNode) BoundProgram
func (*BoundProgram) Print ¶
func (b *BoundProgram) Print()
func (*BoundProgram) PrintStatements ¶
func (b *BoundProgram) PrintStatements()
type Conversion ¶
func ClassifyConversion ¶
func ClassifyConversion(from symbols.TypeSymbol, to symbols.TypeSymbol) Conversion
func CreateConvertion ¶
func CreateConvertion(exists bool, isIdentity bool, isImplicit bool) Conversion
constructor
type GlobalScope ¶
type GlobalScope struct { MainFunction symbols.FunctionSymbol Functions []symbols.FunctionSymbol Variables []symbols.VariableSymbol Classes []symbols.ClassSymbol Structs []symbols.StructSymbol Packages []symbols.PackageSymbol Statements []boundnodes.BoundStatementNode }
func BindGlobalScope ¶
func BindGlobalScope(members []nodes.MemberNode) GlobalScope
func (GlobalScope) Print ¶
func (g GlobalScope) Print()
type Scope ¶
var MainScope Scope
func BindParentScope ¶
func BindParentScope(globalScope GlobalScope) Scope
func BindRootScope ¶
func BindRootScope() Scope
func (Scope) GetAllClasses ¶
func (s Scope) GetAllClasses() []symbols.ClassSymbol
func (Scope) GetAllFunctions ¶
func (s Scope) GetAllFunctions() []symbols.FunctionSymbol
func (Scope) GetAllPackages ¶
func (s Scope) GetAllPackages() []symbols.PackageSymbol
func (Scope) GetAllStructs ¶
func (s Scope) GetAllStructs() []symbols.StructSymbol
func (Scope) GetAllVariables ¶
func (s Scope) GetAllVariables() []symbols.VariableSymbol
func (Scope) InsertFunctionSymbols ¶
func (s Scope) InsertFunctionSymbols(symbols []symbols.FunctionSymbol)
func (Scope) InsertVariableSymbols ¶
func (s Scope) InsertVariableSymbols(symbols []symbols.VariableSymbol)
Click to show internal directories.
Click to hide internal directories.