Documentation ¶
Index ¶
- Variables
- func ComputeHash(str string) int
- type Assignment
- type Binary
- type BuiltinArity0Func
- type BuiltinArity1Func
- type BuiltinArity2Func
- type BuiltinArity3Func
- type CallFunc
- type Compiler
- type CompilerError
- type CompilerOpts
- type DefineDec
- type Expr
- type FunBody
- type FunDec
- type HashConst
- type IfStmt
- type Number
- type Parameter
- type Primary
- type Program
- type ReturnStmt
- type ScalarDec
- type Stmt
- type Stmts
- type TopDec
- type Unary
- type VarDec
- type WhileStmt
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDiv0 = errors.New("division by 0")
View Source
var ErrInvalidFuncCall = errors.New("invalid function call")
View Source
var ErrInvalidState = errors.New("parser produced invalid state")
View Source
var ErrNoMain = errors.New("main function is missing")
View Source
var ErrOutOfTempRegisters = errors.New("compiler ran out of temporary registers")
View Source
var ErrTooManyVars = errors.New("maximum number of variables supported is 15")
View Source
var ErrUnknownLabel = errors.New("unknown label")
View Source
var ErrUnknownVar = errors.New("variable is not known")
Functions ¶
func ComputeHash ¶ added in v0.4.0
Types ¶
type Assignment ¶
type BuiltinArity0Func ¶
type BuiltinArity1Func ¶
type BuiltinArity2Func ¶
type BuiltinArity3Func ¶
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
func NewCompiler ¶
type CompilerError ¶
type CompilerError struct { Pos *lexer.Position Err error CausedBy *CompilerError }
func (CompilerError) Error ¶
func (ce CompilerError) Error() string
type CompilerOpts ¶
type CompilerOpts struct { OptimizeLabels bool PrecomputeExprs bool OptimizeJumps bool PropagateVariables bool EmitDeviceAliases bool PrecomputeHashes bool }
func AllCompilerOpts ¶
func AllCompilerOpts() CompilerOpts
func NoCompilerOpts ¶
func NoCompilerOpts() CompilerOpts
type Primary ¶
type Primary struct { Pos lexer.Position HashConst *HashConst ` @@` Device string `| @Device` BuiltinArity3Func *BuiltinArity3Func `| @@` BuiltinArity2Func *BuiltinArity2Func `| @@` BuiltinArity1Func *BuiltinArity1Func `| @@` BuiltinArity0Func *BuiltinArity0Func `| @@` CallFunc *CallFunc `| @@` Number *Number `| @@` Ident string `| @Ident` StringValue string "| @QuotedStr" SubExpression *Expr `| "(" @@ ")" ` }
type ReturnStmt ¶
type Stmt ¶
type Stmt struct { Pos lexer.Position IfStmt *IfStmt ` @@` ReturnStmt *ReturnStmt `| @@` WhileStmt *WhileStmt `| @@` Assignment *Assignment `| @@` Expr *Expr `| @@` Block *Stmts `| "{" @@ "}"` Empty bool `| @";"` }
Click to show internal directories.
Click to hide internal directories.