Versions in this module Expand all Collapse all v0 v0.0.8 Jan 26, 2021 v0.0.7 Jan 19, 2021 v0.0.6 Jan 19, 2021 v0.0.5 Jan 18, 2021 v0.0.4 Jan 18, 2021 v0.0.3 Jan 15, 2021 v0.0.2 Jan 14, 2021 v0.0.1 Jan 14, 2021 Changes in this version + const BuiltinPackage + const TokenAnd + const TokenAssign + const TokenAt + const TokenBegin + const TokenBoolean + const TokenColon + const TokenComma + const TokenDict + const TokenDo + const TokenDot + const TokenEOF + const TokenElse + const TokenEnd + const TokenEqual + const TokenFalse + const TokenFloat + const TokenFloatConst + const TokenFloatDiv + const TokenFunction + const TokenGreater + const TokenGreaterEqual + const TokenHash + const TokenID + const TokenIf + const TokenImport + const TokenInteger + const TokenIntegerConst + const TokenIntegerDiv + const TokenLCurly + const TokenLParen + const TokenLSquare + const TokenLess + const TokenLessEqual + const TokenList + const TokenMessage + const TokenMessageConst + const TokenMinus + const TokenMultiply + const TokenNotEqual + const TokenOr + const TokenPlus + const TokenPrint + const TokenProgram + const TokenRCurly + const TokenRParen + const TokenRSquare + const TokenReturn + const TokenSemi + const TokenString + const TokenStringConst + const TokenThen + const TokenTrue + const TokenVar + const TokenWhile + var ReservedKeywords = map[string]Token + type ARType string + const ARTypeFunction + const ARTypeProgram + type ActivationRecord struct + Members map[string]interface{} + Name string + NestingLevel int + ReturnValue interface{} + Type ARType + func NewActivationRecord(name string, t ARType, nestingLevel int) *ActivationRecord + func (r *ActivationRecord) Get(key string) interface{} + func (r *ActivationRecord) Set(key string, value interface{}) + func (r *ActivationRecord) String() string + type Assign struct + Left Ast + Op *Token + Right Ast + func NewAssign(left Ast, op *Token, right Ast) *Assign + type Ast interface + type BinOp struct + Left Ast + Op *Token + Right Ast + Token *Token + func NewBinOp(left Ast, op *Token, right Ast) *BinOp + type Block struct + CompoundStatement Ast + Declarations [][]Ast + func NewBlock(declarations [][]Ast, compoundStatement Ast) *Block + type Boolean struct + Token *Token + Value bool + func NewBoolean(token *Token) *Boolean + type BuiltinTypeSymbol struct + Name string + ScopeLevel int + Type Symbol + func NewBuiltinTypeSymbol(name string) *BuiltinTypeSymbol + func (s *BuiltinTypeSymbol) String() string + type CallFunc func(i *Interpreter, args []interface{}) interface + type CallStack struct + func NewCallStack() *CallStack + func (s *CallStack) Peek() *ActivationRecord + func (s *CallStack) Pop() *ActivationRecord + func (s *CallStack) Push(ar *ActivationRecord) + func (s *CallStack) String() string + type Compound struct + Children []Ast + func NewCompound() *Compound + type Dict struct + Token *Token + Value map[string]Ast + func NewDict(token *Token) *Dict + type Error struct + ErrorCode ErrorCode + Message string + Token *Token + Type ErrorType + func (e Error) Error() string + type ErrorCode string + const DuplicateId + const IdNotFound + const UndefinedFunction + const UnexpectedToken + const WrongParamsNum + type ErrorType string + const LexerErrorType + const ParserErrorType + const SemanticErrorType + type FunctionCall struct + ActualParams []Ast + FuncName string + FuncSymbol Symbol + PackageName string + Token *Token + func NewFunctionCall(packageName string, funcName string, actualParams []Ast, token *Token) *FunctionCall + type FunctionDecl struct + BlockNode Ast + FormalParams []Ast + FuncName string + PackageName string + ReturnType Ast + func NewFunctionDecl(funcName string, formalParams []Ast, blockNode Ast, returnType Ast) *FunctionDecl + type FunctionRef struct + FuncName string + PackageName string + Token *Token + func NewFunctionRef(packageName string, funcName string, token *Token) *FunctionRef + type FunctionSymbol struct + BlockAst Ast + Call CallFunc + FormalParams []Ast + Name string + Package string + ReturnType Ast + ScopeLevel int + func NewFunctionSymbol(name string) *FunctionSymbol + func (s *FunctionSymbol) String() string + type If struct + Condition Ast + ElseBranch []Ast + ThenBranch []Ast + func NewIf(condition Ast, thenBranch []Ast, elseBranch []Ast) *If + type Interpreter struct + func NewInterpreter(tree Ast) *Interpreter + func (i *Interpreter) Interpret() (float64, error) + func (i *Interpreter) Stdout() string + func (i *Interpreter) Visit(node Ast) interface{} + func (i *Interpreter) VisitAssign(node *Assign) float64 + func (i *Interpreter) VisitBinOp(node *BinOp) float64 + func (i *Interpreter) VisitBlock(node *Block) float64 + func (i *Interpreter) VisitBoolean(node *Boolean) bool + func (i *Interpreter) VisitCompound(node *Compound) float64 + func (i *Interpreter) VisitDict(node *Dict) map[string]interface{} + func (i *Interpreter) VisitFunctionCall(node *FunctionCall) interface{} + func (i *Interpreter) VisitFunctionDecl(node *FunctionDecl) float64 + func (i *Interpreter) VisitFunctionRef(node *FunctionRef) *FunctionRef + func (i *Interpreter) VisitIf(node *If) interface{} + func (i *Interpreter) VisitList(node *List) []interface{} + func (i *Interpreter) VisitLogical(node *Logical) bool + func (i *Interpreter) VisitMessage(node *Message) interface{} + func (i *Interpreter) VisitNoOp(node *NoOp) float64 + func (i *Interpreter) VisitNumber(node *Number) float64 + func (i *Interpreter) VisitPackage(node *Package) float64 + func (i *Interpreter) VisitPrint(node *Print) interface{} + func (i *Interpreter) VisitProgram(node *Program) float64 + func (i *Interpreter) VisitReturn(node *Return) interface{} + func (i *Interpreter) VisitString(node *String) string + func (i *Interpreter) VisitType(node *Type) float64 + func (i *Interpreter) VisitUnaryOp(node *UnaryOp) float64 + func (i *Interpreter) VisitVar(node *Var) interface{} + func (i *Interpreter) VisitVarDecl(node *VarDecl) float64 + func (i *Interpreter) VisitWhile(node *While) float64 + type Lexer struct + Column int + CurrentChar rune + LineNo int + Pos int + Text []rune + func NewLexer(text []rune) *Lexer + func (l *Lexer) Advance() + func (l *Lexer) GetNextToken() (*Token, error) + func (l *Lexer) Id() (*Token, error) + func (l *Lexer) Message() (*Token, error) + func (l *Lexer) Number() (*Token, error) + func (l *Lexer) Peek() rune + func (l *Lexer) SkipComment() + func (l *Lexer) SkipWhitespace() + func (l *Lexer) String() (*Token, error) + type List struct + Token *Token + Value []Ast + func NewList(token *Token) *List + type Logical struct + Left Ast + Op *Token + Right Ast + func NewLogical(left Ast, op *Token, right Ast) *Logical + type Message struct + Token *Token + Value interface{} + func NewMessage(token *Token) *Message + type NoOp struct + func NewNoOp() *NoOp + type Number struct + Token *Token + Value float64 + func NewNumber(token *Token) *Number + type Package struct + Name string + func NewPackage(name string) *Package + type Param struct + TypeNode Ast + VarNode Ast + func NewParam(varNode Ast, typeNode Ast) *Param + type Parser struct + CurrentToken *Token + Lexer *Lexer + func NewParser(lexer *Lexer) (*Parser, error) + func (p *Parser) AssignmentStatement() (Ast, error) + func (p *Parser) Block() (Ast, error) + func (p *Parser) Comparison() (Ast, error) + func (p *Parser) CompoundStatement() (Ast, error) + func (p *Parser) Declarations() ([][]Ast, error) + func (p *Parser) Dict() (Ast, error) + func (p *Parser) Eat(tokenType TokenType) (err error) + func (p *Parser) Empty() (Ast, error) + func (p *Parser) Equality() (Ast, error) + func (p *Parser) Expr() (Ast, error) + func (p *Parser) Expression() (Ast, error) + func (p *Parser) Factor() (Ast, error) + func (p *Parser) FormalParameterList() ([]Ast, error) + func (p *Parser) FormalParameters() ([]Ast, error) + func (p *Parser) FunctionCallStatement() (Ast, error) + func (p *Parser) FunctionDeclaration() (Ast, error) + func (p *Parser) FunctionReference() (Ast, error) + func (p *Parser) IfStatement() (Ast, error) + func (p *Parser) List() (Ast, error) + func (p *Parser) LogicAnd() (Ast, error) + func (p *Parser) LogicOr() (Ast, error) + func (p *Parser) Package() ([]Ast, error) + func (p *Parser) Parse() (Ast, error) + func (p *Parser) PrintStatement() (Ast, error) + func (p *Parser) Program() (Ast, error) + func (p *Parser) ReturnStatement() (Ast, error) + func (p *Parser) Statement() (Ast, error) + func (p *Parser) StatementList() ([]Ast, error) + func (p *Parser) Term() (Ast, error) + func (p *Parser) TypeSpec() (Ast, error) + func (p *Parser) Variable() (Ast, error) + func (p *Parser) VariableDeclaration() ([]Ast, error) + func (p *Parser) WhileStatement() (Ast, error) + type Print struct + Statement Ast + func NewPrint(statement Ast) *Print + type Program struct + Block Ast + Name string + Packages []Ast + func NewProgram(name string, packages []Ast, block Ast) *Program + type Return struct + Statement Ast + func NewReturn(statement Ast) *Return + type ScopedSymbolTable struct + EnclosingScope *ScopedSymbolTable + ScopeLevel int + ScopeName string + func NewScopedSymbolTable(scopeName string, scopeLevel int, enclosingScope *ScopedSymbolTable) *ScopedSymbolTable + func (t *ScopedSymbolTable) Insert(symbol Symbol) + func (t *ScopedSymbolTable) Lookup(name string, currentScopeOnly bool) Symbol + func (t *ScopedSymbolTable) String() string + type SemanticAnalyzer struct + CurrentScope *ScopedSymbolTable + func NewSemanticAnalyzer() *SemanticAnalyzer + func (b *SemanticAnalyzer) Visit(node Ast) + func (b *SemanticAnalyzer) VisitAssign(node *Assign) + func (b *SemanticAnalyzer) VisitBinOp(node *BinOp) + func (b *SemanticAnalyzer) VisitBlock(node *Block) + func (b *SemanticAnalyzer) VisitBoolean(node *Boolean) + func (b *SemanticAnalyzer) VisitCompound(node *Compound) + func (b *SemanticAnalyzer) VisitDict(node *Dict) + func (b *SemanticAnalyzer) VisitFunctionCall(node *FunctionCall) + func (b *SemanticAnalyzer) VisitFunctionDecl(node *FunctionDecl) + func (b *SemanticAnalyzer) VisitFunctionRef(node *FunctionRef) + func (b *SemanticAnalyzer) VisitIf(node *If) + func (b *SemanticAnalyzer) VisitList(node *List) + func (b *SemanticAnalyzer) VisitLogical(node *Logical) + func (b *SemanticAnalyzer) VisitMessage(node *Message) + func (b *SemanticAnalyzer) VisitNoOp(node *NoOp) + func (b *SemanticAnalyzer) VisitNumber(node *Number) + func (b *SemanticAnalyzer) VisitPackage(node *Package) + func (b *SemanticAnalyzer) VisitPrint(node *Print) + func (b *SemanticAnalyzer) VisitProgram(node *Program) + func (b *SemanticAnalyzer) VisitReturn(node *Return) + func (b *SemanticAnalyzer) VisitString(node *String) + func (b *SemanticAnalyzer) VisitType(node *Type) + func (b *SemanticAnalyzer) VisitUnaryOp(node *UnaryOp) + func (b *SemanticAnalyzer) VisitVar(node *Var) + func (b *SemanticAnalyzer) VisitVarDecl(node *VarDecl) + func (b *SemanticAnalyzer) VisitWhile(node *While) + type String struct + Token *Token + Value string + func NewString(token *Token) *String + type Symbol interface + type Token struct + Column int + LineNo int + Type TokenType + Value interface{} + func (t *Token) String() string + type TokenType string + type Type struct + Token *Token + Value interface{} + func NewType(token *Token) *Type + type UnaryOp struct + Expr Ast + Op *Token + func NewUnaryOp(op *Token, expr Ast) *UnaryOp + type Var struct + Token *Token + Value interface{} + func NewVar(token *Token) *Var + type VarDecl struct + TypeNode Ast + VarNode Ast + func NewVarDecl(varNode Ast, typeNode Ast) *VarDecl + type VarSymbol struct + Name string + ScopeLevel int + Type Symbol + func NewVarSymbol(name string, t Symbol) *VarSymbol + func (s *VarSymbol) String() string + type While struct + Condition Ast + DoBranch []Ast + func NewWhile(condition Ast, doBranch []Ast) *While