ast

package
v0.0.0-...-5710c07 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddExp

type AddExp struct {
	BaseExp
	HeadExp   *MultExp
	Operators []string
	TailExps  []*MultExp
}

func NewAddExp

func NewAddExp(baseExp BaseExp, headExp *MultExp, operators []string, tailExps []*MultExp) *AddExp

NewAddExp Create a new AddExp

func (AddExp) TokenLiteral

func (a AddExp) TokenLiteral() string

type AddExpHandler

type AddExpHandler interface {
	AddExp(*AddExp) bool
}

type BaseExp

type BaseExp struct{}

func (BaseExp) Type

func (b BaseExp) Type() string

type BaseFactor

type BaseFactor struct{}

func (BaseFactor) Type

func (b BaseFactor) Type() string

type BaseStatement

type BaseStatement struct{}

func (BaseStatement) Type

func (b BaseStatement) Type() string

type BitMode

type BitMode int
const (
	ID_16BIT_MODE BitMode = 16
	ID_32BIT_MODE BitMode = 32
	ID_64BIT_MODE BitMode = 64
)

func NewBitMode

func NewBitMode(i int) (BitMode, bool)

type CharFactor

type CharFactor struct {
	BaseFactor
	Value string
}

func NewCharFactor

func NewCharFactor(baseFactor BaseFactor, value string) *CharFactor

NewCharFactor Create a new CharFactor

func (CharFactor) TokenLiteral

func (c CharFactor) TokenLiteral() string

type CharFactorHandler

type CharFactorHandler interface {
	CharFactor(*CharFactor) bool
}

type ConfigStmt

type ConfigStmt struct {
	BaseStatement
	ConfigType ConfigType
	Factor     Factor
}

func NewConfigStmt

func NewConfigStmt(baseStatement BaseStatement, configType ConfigType, factor Factor) *ConfigStmt

NewConfigStmt Create a new ConfigStmt

func (ConfigStmt) TokenLiteral

func (c ConfigStmt) TokenLiteral() string

type ConfigStmtHandler

type ConfigStmtHandler interface {
	ConfigStmt(*ConfigStmt) bool
}

type ConfigType

type ConfigType string

TODO: go generateで作成できないか

const (
	Bits     ConfigType = "BITS"
	InstrSet ConfigType = "INSTRSET"
	Optimize ConfigType = "OPTIMIZE"
	Format   ConfigType = "FORMAT"
	Padding  ConfigType = "PADDING"
	PadSet   ConfigType = "PADSET"
	Section  ConfigType = "SECTION"
	Absolute ConfigType = "ABSOLUTE"
	File     ConfigType = "FILE"
)

func NewConfigType

func NewConfigType(s string) (ConfigType, bool)

type DataType

type DataType string

TODO: go generateで作成できないか

const (
	Byte  DataType = "BYTE"
	Word  DataType = "WORD"
	Dword DataType = "DWORD"
	None  DataType = ""
)

func NewDataType

func NewDataType(s string) (DataType, bool)

type DeclareStmt

type DeclareStmt struct {
	BaseStatement
	Id    *IdentFactor
	Value Exp // interfaceはポインタにしない
}

func NewDeclareStmt

func NewDeclareStmt(baseStatement BaseStatement, id *IdentFactor, value Exp) *DeclareStmt

NewDeclareStmt Create a new DeclareStmt

func (DeclareStmt) TokenLiteral

func (d DeclareStmt) TokenLiteral() string

type DeclareStmtHandler

type DeclareStmtHandler interface {
	DeclareStmt(*DeclareStmt) bool
}

type DefaultHandler

type DefaultHandler interface {
	Handle(Node) bool
}

type Exp

type Exp interface {
	Node

	Type() string
	// contains filtered or unexported methods
}

type ExportSymStmt

type ExportSymStmt struct {
	BaseStatement
	Symbols []*IdentFactor
}

func NewExportSymStmt

func NewExportSymStmt(baseStatement BaseStatement, symbols []*IdentFactor) *ExportSymStmt

NewExportSymStmt Create a new ExportSymStmt

func (ExportSymStmt) TokenLiteral

func (es ExportSymStmt) TokenLiteral() string

type ExportSymStmtHandler

type ExportSymStmtHandler interface {
	ExportSymStmt(*ExportSymStmt) bool
}

type ExternSymStmt

type ExternSymStmt struct {
	BaseStatement
	Symbols []*IdentFactor
}

func NewExternSymStmt

func NewExternSymStmt(baseStatement BaseStatement, symbols []*IdentFactor) *ExternSymStmt

NewExternSymStmt Create a new ExternSymStmt

func (ExternSymStmt) TokenLiteral

func (es ExternSymStmt) TokenLiteral() string

type ExternSymStmtHandler

type ExternSymStmtHandler interface {
	ExternSymStmt(*ExternSymStmt) bool
}

type Factor

type Factor interface {
	Node
	Type() string
	// contains filtered or unexported methods
}

type HexFactor

type HexFactor struct {
	BaseFactor
	Value string
}

func NewHexFactor

func NewHexFactor(baseFactor BaseFactor, value string) *HexFactor

NewHexFactor Create a new HexFactor

func (HexFactor) TokenLiteral

func (h HexFactor) TokenLiteral() string

type HexFactorHandler

type HexFactorHandler interface {
	HexFactor(*HexFactor) bool
}

type IdentFactor

type IdentFactor struct {
	BaseFactor
	Value string
}

func NewIdentFactor

func NewIdentFactor(baseFactor BaseFactor, value string) *IdentFactor

NewIdentFactor Create a new IdentFactor

func (IdentFactor) TokenLiteral

func (i IdentFactor) TokenLiteral() string

type IdentFactorHandler

type IdentFactorHandler interface {
	IdentFactor(*IdentFactor) bool
}

type ImmExp

type ImmExp struct {
	BaseExp
	Factor Factor
}

func NewImmExp

func NewImmExp(baseExp BaseExp, factor Factor) *ImmExp

NewImmExp Create a new ImmExp

func (ImmExp) TokenLiteral

func (imm ImmExp) TokenLiteral() string

type ImmExpHandler

type ImmExpHandler interface {
	ImmExp(*ImmExp) bool
}

type JumpType

type JumpType string

TODO: go generateで作成できないか

const (
	Short JumpType = "SHORT"
	Near  JumpType = "NEAR"
	Far   JumpType = "FAR"
	Empty JumpType = ""
)

func NewJumpType

func NewJumpType(s string) (JumpType, bool)

type LabelStmt

type LabelStmt struct {
	BaseStatement
	Label *IdentFactor
}

func NewLabelStmt

func NewLabelStmt(baseStatement BaseStatement, label *IdentFactor) *LabelStmt

NewLabelStmt Create a new LabelStmt

func (LabelStmt) TokenLiteral

func (l LabelStmt) TokenLiteral() string

type LabelStmtHandler

type LabelStmtHandler interface {
	LabelStmt(*LabelStmt) bool
}

type MemoryAddrExp

type MemoryAddrExp struct {
	BaseExp
	DataType DataType
	JumpType JumpType
	Left     *AddExp
	Right    *AddExp // nullable
}

func NewMemoryAddrExp

func NewMemoryAddrExp(baseExp BaseExp, dataType DataType, jumpType JumpType, left *AddExp, right *AddExp) *MemoryAddrExp

NewMemoryAddrExp Create a new MemoryAddrExp

func (MemoryAddrExp) TokenLiteral

func (m MemoryAddrExp) TokenLiteral() string

type MemoryAddrExpHandler

type MemoryAddrExpHandler interface {
	MemoryAddrExp(*MemoryAddrExp) bool
}

type MnemonicStmt

type MnemonicStmt struct {
	BaseStatement
	Opcode   *IdentFactor
	Operands []Exp
}

func NewMnemonicStmt

func NewMnemonicStmt(baseStatement BaseStatement, opcode *IdentFactor, operands []Exp) *MnemonicStmt

NewMnemonicStmt Create a new MnemonicStmt

func (MnemonicStmt) TokenLiteral

func (ms MnemonicStmt) TokenLiteral() string

type MnemonicStmtHandler

type MnemonicStmtHandler interface {
	MnemonicStmt(*MnemonicStmt) bool
}

type MultExp

type MultExp struct {
	BaseExp
	HeadExp   *ImmExp
	Operators []string
	TailExps  []*ImmExp
}

func NewMultExp

func NewMultExp(baseExp BaseExp, headExp *ImmExp, operators []string, tailExps []*ImmExp) *MultExp

NewMultExp Create a new MultExp

func (MultExp) TokenLiteral

func (m MultExp) TokenLiteral() string

type MultExpHandler

type MultExpHandler interface {
	MultExp(*MultExp) bool
}

type Node

type Node interface {
	TokenLiteral() string
}

type NumberFactor

type NumberFactor struct {
	BaseFactor
	Value int
}

func NewNumberFactor

func NewNumberFactor(baseFactor BaseFactor, value int) *NumberFactor

NewNumberFactor Create a new NumberFactor

func (NumberFactor) TokenLiteral

func (n NumberFactor) TokenLiteral() string

type NumberFactorHandler

type NumberFactorHandler interface {
	NumberFactor(*NumberFactor) bool
}

type Prog

type Prog interface {
	Node
	Type() string
	// contains filtered or unexported methods
}

type Program

type Program struct {
	Statements []Statement
}

func NewProgram

func NewProgram(statements []Statement) *Program

NewProgram Create a new Program

func (Program) String

func (p Program) String() string

func (Program) TokenLiteral

func (p Program) TokenLiteral() string

func (Program) Type

func (p Program) Type() string

type ProgramHandler

type ProgramHandler interface {
	Program(*Program) bool
}

type SegmentExp

type SegmentExp struct {
	BaseExp
	DataType DataType
	Left     *AddExp
	Right    *AddExp // nullable
}

func NewSegmentExp

func NewSegmentExp(baseExp BaseExp, dataType DataType, left *AddExp, right *AddExp) *SegmentExp

NewSegmentExp Create a new SegmentExp

func (SegmentExp) TokenLiteral

func (s SegmentExp) TokenLiteral() string

type SegmentExpHandler

type SegmentExpHandler interface {
	SegmentExp(*SegmentExp) bool
}

type Statement

type Statement interface {
	Node
	Type() string
	// contains filtered or unexported methods
}

type StringFactor

type StringFactor struct {
	BaseFactor
	Value string
}

func NewStringFactor

func NewStringFactor(baseFactor BaseFactor, value string) *StringFactor

NewStringFactor Create a new StringFactor

func (StringFactor) TokenLiteral

func (s StringFactor) TokenLiteral() string

type StringFactorHandler

type StringFactorHandler interface {
	StringFactor(*StringFactor) bool
}

type SupCPU

type SupCPU int
const (
	SUP_8086           SupCPU = 0
	SUP_80186          SupCPU = 1
	SUP_80286          SupCPU = 2
	SUP_80386          SupCPU = 3
	SUP_80486          SupCPU = 4
	SUP_Pentium        SupCPU = 5
	SUP_PentiumWithMMX SupCPU = 6
	SUP_PentiumPro     SupCPU = 7
	SUP_Pentium2       SupCPU = 8
	SUP_Pentium3       SupCPU = 9
	SUP_Pentium4       SupCPU = 10
	SUP_Core           SupCPU = 11
	SUP_Core2          SupCPU = 12
	SUP_Core7          SupCPU = 13
	SUP_Itanium        SupCPU = 99
)

http://ref.x86asm.net/index.html -------------------------------- 00: 8086 01: 80186 02: 80286 03: 80386 (i386) 04: 80486 (i486) P1 (05): Pentium (1) PX (06): Pentium with MMX PP (07): Pentium Pro P2 (08): Pentium II P3 (09): Pentium III P4 (10): Pentium 4 C1 (11): Core (1) C2 (12): Core 2 C7 (13): Core i7 IT (99): Itanium (only geek editions)

func NewSupCPU

func NewSupCPU(i int) (SupCPU, bool)

type SupCPURange

type SupCPURange struct {
	Start    SupCPU // 範囲の開始
	End      SupCPU // 範囲の終了
	AnyLater bool   // 任意の後続プロセッサをサポート
	LateStep bool   // 後続プロセッサの特定ステッピングのみサポート
}

func NewSupCPUByCode

func NewSupCPUByCode(code string) (*SupCPURange, bool)

func (SupCPURange) IsSupported

func (r SupCPURange) IsSupported(targetCPU SupCPU) bool

type Visitor

type Visitor struct {
	// contains filtered or unexported fields
}

func (*Visitor) Handler

func (v *Visitor) Handler(h interface{}) error

func (*Visitor) Visit

func (v *Visitor) Visit(n Node) *Visitor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL