Documentation
¶
Index ¶
- func AssignementTypeChecking(tree parser.VariableAssignStmt, type1 string, type2 string, env *Env) bool
- func HandleError(tree parser.VariableAssignStmt, err error, env *Env)
- func IndexableAssignmentChecks(index parser.IndexableAccessExpr, env *Env) *eclaType.Type
- func IsMultipleBus(b []*Bus) bool
- func Load(env *Env)
- func Run(env *Env)
- func RunBodyFunction(fn *eclaType.Function, env *Env) ([]eclaType.Type, error)
- func RunFunctionCallExprWithArgs(Name string, env *Env, fn *eclaType.Function, args []eclaType.Type) ([]eclaType.Type, error)
- func RunFunctionDecl(tree parser.FunctionDecl, env *Env)
- func RunImportStmt(stmt parser.ImportStmt, env *Env)
- func RunMurlocStmt(stmt parser.MurlocStmt, env *Env)
- func RunReturnStmt(tree parser.ReturnStmt, env *Env) []eclaType.Type
- func RunStructDecl(tree parser.StructDecl, env *Env)
- func RunVariableAssignStmt(tree parser.VariableAssignStmt, env *Env)
- func RunVariableDecl(tree parser.VariableDecl, env *Env)
- type Bus
- func New(t parser.Literal, env *Env) *Bus
- func NewMainBus(Val eclaType.Type) *Bus
- func NewNoneBus() *Bus
- func NewReturnBus(Val eclaType.Type) *Bus
- func RunAnonymousFunctionCallExpr(tree parser.AnonymousFunctionCallExpr, env *Env) []*Bus
- func RunAnonymousFunctionExpr(AnonymousFunc parser.AnonymousFunctionExpr, env *Env) []*Bus
- func RunArrayLiteral(tree parser.ArrayLiteral, env *Env) *Bus
- func RunBinaryExpr(tree parser.BinaryExpr, env *Env) *Bus
- func RunBlockScopeStmt(tree parser.BlockScopeStmt, env *Env) []*Bus
- func RunForStmt(For parser.ForStmt, env *Env) *Bus
- func RunFunctionCallExpr(tree parser.FunctionCallExpr, env *Env) []*Bus
- func RunIfStmt(tree parser.IfStmt, env *Env) *Bus
- func RunIndexableAccessExpr(tree parser.IndexableAccessExpr, env *Env) *Bus
- func RunMapLiteral(tree parser.MapLiteral, env *Env) *Bus
- func RunSelectorExpr(expr parser.SelectorExpr, env *Env, Struct eclaType.Type) []*Bus
- func RunStructInstantiationExpr(tree parser.StructInstantiationExpr, env *Env) []*Bus
- func RunTree(tree parser.Node, env *Env) []*Bus
- func RunTreeLoad(tree parser.Node, env *Env) []*Bus
- func RunUnaryExpr(tree parser.UnaryExpr, env *Env) *Bus
- func RunWhileStmt(tree parser.WhileStmt, env *Env) *Bus
- type BusType
- type Env
- func (env *Env) AddFunctionExecuted(f *eclaType.Function)
- func (env *Env) AddTypeDecl(t eclaDecl.TypeDecl)
- func (env *Env) CheckIfVarExistsInCurrentScope(name string) bool
- func (env *Env) ConvertToLib(MainEnv *Env) libs.Lib
- func (env *Env) EndScope()
- func (env *Env) Execute()
- func (env *Env) ExecuteMetrics() met.Metrics
- func (env *Env) GetFunctionExecuted() *eclaType.Function
- func (env *Env) GetTypeDecl(name string) (eclaDecl.TypeDecl, bool)
- func (env *Env) GetVar(name string) (*eclaType.Var, bool)
- func (env *Env) Import(stmt parser.ImportStmt)
- func (env *Env) Load()
- func (env *Env) NewScope(Type ScopeType)
- func (env *Env) RemoveFunctionExecuted()
- func (env *Env) SetCode(code string)
- func (env *Env) SetFile(file string)
- func (env *Env) SetFunction(name string, f *eclaType.Function) error
- func (env *Env) SetScope(s *Scope)
- func (env *Env) SetVar(name string, value *eclaType.Var)
- func (env *Env) String() string
- type Scope
- func (s *Scope) CheckIfVarExistsInCurrentScope(name string) bool
- func (s *Scope) Get(name string) (*eclaType.Var, bool)
- func (s *Scope) GetFunctionScope() *Scope
- func (s *Scope) GetNextScope() *Scope
- func (s *Scope) GoDeep(Type ScopeType)
- func (s *Scope) GoDeepWithSpecificScope(Scope *Scope)
- func (s *Scope) GoUp()
- func (s *Scope) InFunction() bool
- func (s *Scope) Set(name string, value *eclaType.Var)
- func (s *Scope) SetNextScope(next *Scope)
- type ScopeType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignementTypeChecking ¶
func AssignementTypeChecking(tree parser.VariableAssignStmt, type1 string, type2 string, env *Env) bool
AssignementTypeChecking checks if the type of the variable is the same as the type of the expression. If the type of the variable is any, it returns true else it returns false.
func HandleError ¶
func HandleError(tree parser.VariableAssignStmt, err error, env *Env)
TODO : Remove this function @mkarten
func IndexableAssignmentChecks ¶
func IndexableAssignmentChecks(index parser.IndexableAccessExpr, env *Env) *eclaType.Type
IndexableAssignmentChecks checks if the indexable variable is valid
func IsMultipleBus ¶
IsMultipleBus returns true if the bus is a multiple bus.
func RunBodyFunction ¶
RunBodyFunction executes the code associated with the function.
func RunFunctionCallExprWithArgs ¶
func RunFunctionCallExprWithArgs(Name string, env *Env, fn *eclaType.Function, args []eclaType.Type) ([]eclaType.Type, error)
RunFunctionCallExprWithArgs executes a parser.FunctionCallExpr with the given arguments.
func RunFunctionDecl ¶
func RunFunctionDecl(tree parser.FunctionDecl, env *Env)
RunFunctionDecl executes a parser.FunctionDecl.
func RunImportStmt ¶
func RunImportStmt(stmt parser.ImportStmt, env *Env)
RunImportStmt executes a parser.ImportStmt.
func RunMurlocStmt ¶
func RunMurlocStmt(stmt parser.MurlocStmt, env *Env)
RunMurlocStmt executes a parser.MurlocStmt.
func RunReturnStmt ¶
func RunReturnStmt(tree parser.ReturnStmt, env *Env) []eclaType.Type
RunReturnStmt runs the return statement
func RunStructDecl ¶
func RunStructDecl(tree parser.StructDecl, env *Env)
func RunVariableAssignStmt ¶
func RunVariableAssignStmt(tree parser.VariableAssignStmt, env *Env)
RunVariableAssignStmt Run assigns a variable.
func RunVariableDecl ¶
func RunVariableDecl(tree parser.VariableDecl, env *Env)
RunVariableDecl executes a parser.VariableDecl.
Types ¶
type Bus ¶
func NewReturnBus ¶
NewReturnBus returns a new return bus.
func RunAnonymousFunctionCallExpr ¶
func RunAnonymousFunctionCallExpr(tree parser.AnonymousFunctionCallExpr, env *Env) []*Bus
func RunAnonymousFunctionExpr ¶
func RunAnonymousFunctionExpr(AnonymousFunc parser.AnonymousFunctionExpr, env *Env) []*Bus
func RunArrayLiteral ¶
func RunArrayLiteral(tree parser.ArrayLiteral, env *Env) *Bus
RunArrayLiteral executes a parser.ArrayLiteral.
func RunBinaryExpr ¶
func RunBinaryExpr(tree parser.BinaryExpr, env *Env) *Bus
RunBinaryExpr executes a parser.BinaryExpr.
func RunBlockScopeStmt ¶
func RunBlockScopeStmt(tree parser.BlockScopeStmt, env *Env) []*Bus
func RunForStmt ¶
RunForStmt runs the for statement
func RunFunctionCallExpr ¶
func RunFunctionCallExpr(tree parser.FunctionCallExpr, env *Env) []*Bus
RunFunctionCallExpr executes a parser.FunctionCallExpr.
func RunIndexableAccessExpr ¶
func RunIndexableAccessExpr(tree parser.IndexableAccessExpr, env *Env) *Bus
RunIndexableAccessExpr executes a parser.IndexableAccessExpr.
func RunMapLiteral ¶
func RunMapLiteral(tree parser.MapLiteral, env *Env) *Bus
RunMapLiteral executes a parser.MapLiteral.
func RunSelectorExpr ¶
func RunStructInstantiationExpr ¶
func RunStructInstantiationExpr(tree parser.StructInstantiationExpr, env *Env) []*Bus
func RunTreeLoad ¶
RunTreeLoad is special version of RunTree that is used to load the environment (function, variable, import)
func RunUnaryExpr ¶
RunUnaryExpr executes a parser.UnaryExpr.
func RunWhileStmt ¶
RunWhileStmt runs the while statement
func (*Bus) TransformTo ¶
TransformTo transforms the bus to the given type.
type Env ¶
type Env struct { Vars *Scope OS string ARCH string SyntaxTree *parser.File Tokens []lexer.Token File string Code string Libs map[string]libs.Lib ErrorHandle *errorHandler.ErrorHandler ExecutedFunc []*eclaType.Function TypeDecl []eclaDecl.TypeDecl }
Env is the environment in which the code is executed.
func NewTemporaryEnv ¶
func NewTemporaryEnv(ErrorHandler *errorHandler.ErrorHandler) *Env
NewTemporaryEnv returns a new temporary Env. Temporary Env are used to import modules.
func (*Env) AddFunctionExecuted ¶
AddFunctionExecuted adds a function to the pile of executed functions.
func (*Env) AddTypeDecl ¶
func (*Env) CheckIfVarExistsInCurrentScope ¶
CheckIfVarExistsInCurrentScope returns true if the variable exists in the current scope.
func (*Env) ConvertToLib ¶
ConvertToLib converts the Env to a Lib.
func (*Env) ExecuteMetrics ¶
func (*Env) GetFunctionExecuted ¶
GetFunctionExecuted returns the last function executed.
func (*Env) Import ¶
func (env *Env) Import(stmt parser.ImportStmt)
Import executes an import statement.
func (*Env) RemoveFunctionExecuted ¶
func (env *Env) RemoveFunctionExecuted()
RemoveFunctionExecuted removes the last function executed.
func (*Env) SetFunction ¶
SetFunction sets the function with the given name.
type Scope ¶
type Scope struct { Var map[string]*eclaType.Var Type ScopeType InFunc bool // contains filtered or unexported fields }
Scope is a scope.
func InitBuildIn ¶
func InitBuildIn() *Scope
func (*Scope) CheckIfVarExistsInCurrentScope ¶
CheckIfVarExistsInCurrentScope returns true if the variable exists in the current scope.
func (*Scope) GetFunctionScope ¶
GetFunctionScope returns the function scope.
func (*Scope) GetNextScope ¶
GetNextScope returns the next scope.
func (*Scope) GoDeepWithSpecificScope ¶
GoDeepWithSpecificScope goes deep with a specific scope.
func (*Scope) InFunction ¶
InFunction returns true if the scope is in a function.
func (*Scope) SetNextScope ¶
SetNextScope sets the next scope.