Documentation
¶
Overview ¶
Copyright 2024 Blake Felt blake.w.felt@gmail.com
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copyright 2024 Blake Felt blake.w.felt@gmail.com
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copyright 2024 Blake Felt blake.w.felt@gmail.com
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copyright 2024 Blake Felt blake.w.felt@gmail.com
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copyright 2024 Blake Felt blake.w.felt@gmail.com
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copyright 2024 Blake Felt blake.w.felt@gmail.com
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copyright 2024 Blake Felt blake.w.felt@gmail.com
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copyright 2024 Blake Felt blake.w.felt@gmail.com
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
Index ¶
- Constants
- type Arg
- type ArgExpr
- type ArgJump
- type ArgReg
- type Assembler
- type Compiler
- type ExpectedTokenError
- type Expr
- type ExprBinary
- type ExprLiteral
- type ExprUnary
- type FileRef
- type GenericTokenError
- type InstrArgCountError
- type InstrArgTypeError
- type Label
- type ReduceIndex
- type ReduceTrie
- type Runner
- type Section
- type Stmnt
- type StmntDirective
- type StmntGlobal
- type StmntInstr
- type StmntInt
- type StmntLabel
- type Token
- type UnfinishedError
- type UnknownIdentifierError
- type UnknownTokenError
Constants ¶
const TEST_POSTLUDE = `
jump done
`
const TEST_PRELUDE = `` /* 2886-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compiler ¶
type Compiler struct { Labels map[string]*Label Boot Section BootData Section Text Section Data Section Bss Section Stack Section // data not placed here CurrentSection *Section // contains filtered or unexported fields }
func (*Compiler) CompileToAsm ¶
func (*Compiler) CompileToBin ¶
func (*Compiler) FormatSections ¶
type ExpectedTokenError ¶
type ExpectedTokenError struct {
// contains filtered or unexported fields
}
func (ExpectedTokenError) Error ¶
func (e ExpectedTokenError) Error() string
type ExprBinary ¶
func (ExprBinary) IsRelative ¶
func (exp ExprBinary) IsRelative() bool
func (ExprBinary) String ¶
func (exp ExprBinary) String() string
type ExprLiteral ¶
type ExprLiteral struct {
Operator Token
}
func (ExprLiteral) IsRelative ¶
func (exp ExprLiteral) IsRelative() bool
func (ExprLiteral) String ¶
func (exp ExprLiteral) String() string
type ExprUnary ¶
func (ExprUnary) IsRelative ¶
type GenericTokenError ¶
type GenericTokenError struct {
// contains filtered or unexported fields
}
func (GenericTokenError) Error ¶
func (e GenericTokenError) Error() string
type InstrArgCountError ¶
type InstrArgCountError struct {
// contains filtered or unexported fields
}
func (InstrArgCountError) Error ¶
func (e InstrArgCountError) Error() string
type InstrArgTypeError ¶
type InstrArgTypeError struct { Stmnt StmntInstr ArgN int // argument number }
func (InstrArgTypeError) Error ¶
func (e InstrArgTypeError) Error() string
type ReduceIndex ¶
type ReduceIndex struct { Index int // the starting index Node *ReduceTrie // the last node that this uses }
func (*ReduceIndex) Next ¶
func (r *ReduceIndex) Next(instruction StmntInstr) error
add the next instruction to the associated trie
type ReduceTrie ¶
type ReduceTrie struct { Indexes []int // indexes that uses this statement Depth int // depth of this node Instr string // the string version of this instruction TokenType token.Type Children map[string]*ReduceTrie Parent *ReduceTrie Final bool // if this is a final node (a jump) }
func (*ReduceTrie) AddChild ¶
func (r *ReduceTrie) AddChild(index int, instruction StmntInstr) (*ReduceTrie, error)
func (*ReduceTrie) Max ¶
func (r *ReduceTrie) Max() (*ReduceTrie, int, error)
func (*ReduceTrie) Value ¶
func (r *ReduceTrie) Value() int
type Runner ¶
type Runner struct { AssemblyName string // the "name" of the input assembly files ReservedBytes int // the number of bytes reserved for the emulator Reduce bool // should the assembler perform code reduction Timeout time.Duration // maximum time per test allowed Hardware usb.Hardware // the serial port (optional) }
func (*Runner) RunTestWithHeader ¶
func (*Runner) SetDefaults ¶
func (r *Runner) SetDefaults()
Sets AssemblyName, ReservedBytes, and Reduce to a default.
type Section ¶
type StmntDirective ¶
type StmntDirective struct {
Directive Token
}
func (StmntDirective) CanReduce ¶
func (s StmntDirective) CanReduce() bool
func (StmntDirective) Compile ¶
func (s StmntDirective) Compile(labels map[string]*Label) ([]byte, error)
func (StmntDirective) IsFinalReduce ¶
func (s StmntDirective) IsFinalReduce() bool
func (StmntDirective) Size ¶
func (s StmntDirective) Size() int
type StmntGlobal ¶
type StmntGlobal struct {
Label Token
}
func (StmntGlobal) CanReduce ¶
func (s StmntGlobal) CanReduce() bool
func (StmntGlobal) IsFinalReduce ¶
func (s StmntGlobal) IsFinalReduce() bool
func (StmntGlobal) Size ¶
func (s StmntGlobal) Size() int
func (StmntGlobal) String ¶
func (s StmntGlobal) String() string
type StmntInstr ¶
func (StmntInstr) CanReduce ¶
func (s StmntInstr) CanReduce() bool
func (StmntInstr) IsFinalReduce ¶
func (s StmntInstr) IsFinalReduce() bool
func (*StmntInstr) Setup ¶
func (s *StmntInstr) Setup()
func (StmntInstr) Size ¶
func (s StmntInstr) Size() int
func (*StmntInstr) String ¶
func (s *StmntInstr) String() string
type StmntLabel ¶
type StmntLabel struct {
Label Token
}
func (StmntLabel) CanReduce ¶
func (s StmntLabel) CanReduce() bool
func (StmntLabel) IsFinalReduce ¶
func (s StmntLabel) IsFinalReduce() bool
func (StmntLabel) Size ¶
func (s StmntLabel) Size() int
func (StmntLabel) String ¶
func (s StmntLabel) String() string
type Token ¶
type UnfinishedError ¶
type UnfinishedError struct {
// contains filtered or unexported fields
}
func (UnfinishedError) Error ¶
func (e UnfinishedError) Error() string
type UnknownIdentifierError ¶
type UnknownIdentifierError struct {
// contains filtered or unexported fields
}
func (UnknownIdentifierError) Error ¶
func (e UnknownIdentifierError) Error() string
type UnknownTokenError ¶
type UnknownTokenError struct {
// contains filtered or unexported fields
}
func (UnknownTokenError) Error ¶
func (e UnknownTokenError) Error() string