ast

package
v0.0.0-...-bdb7d28 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Mem4       *MemAddr4   `  @@`
	Mem3       *MemAddr3   `| @@`
	Mem2       *MemAddr2   `| @@`
	Mem1       *MemAddr1   `| @@`
	Vector     *Vector     `| @@`
	Extend     *ExtendArg  `| @@`
	RegOrLabel *RegOrLabel `| @@`
	Imm        *Imm        `| @@`
}

type ExtendArg

type ExtendArg struct {
	Op  string  `@("lsl" | "lsr" | "msl" | "asr" | "ror" | "uxtw" | "sxth" | "sxtw" | "sxtx" | "sxtb" | "uxth" | "uxtb" | "uxtx")`
	Imm *string `('#'? @((Number | '-' | '+' | '(' | ')')+))?`
}

type Imm

type Imm struct {
	Num   *string `('#'? @((Number | '-' | '+' | '(' | ')')+))`
	Reloc *Reloc  `| @@`
}

type Inst

type Inst struct {
	Pos lexer.Position

	Label *string `(@(Ident | Number) ':')?`
	Name  string  `@Ident`
	Args  []*Arg  `( @@ ( "," @@ )* )? (Newline*|EOF)`
}

func Parse

func Parse(name string, r io.Reader) (*Inst, error)

type MemAddr1

type MemAddr1 struct {
	Reg string `"[" @Ident`
	Imm *Imm   `("," @@)? "]"`
}

[Xn{, #i}]

type MemAddr2

type MemAddr2 struct {
	Reg      string `"[" @Ident "]"`
	RegOrImm string `"," ("#"? @Number | @Ident)`
}

[Xn], #i Xn += i after access

type MemAddr3

type MemAddr3 struct {
	Reg string `"[" @Ident`
	Imm string `"," "#"? @(Number) "]" "!"`
}

[Xn, #i]! Xn += i before access

type MemAddr4

type MemAddr4 struct {
	Reg1   string     `"[" @Ident`
	Reg2   string     `"," @Ident`
	Extend *ExtendArg `("," @@)? "]"`
}

[Xn, Wm, {s,u}xtw{ #i|s}] [Xn, Xm sxtx{ #i|s}]

type RegOrLabel

type RegOrLabel struct {
	Indexed *string `@(Ident '[' Number ']')`
	Val     *string `| @Ident`
}

type Reloc

type Reloc struct {
	Type string `'#'? ':' @Ident ':'`
	Var  string `@Ident`
}

type Vector

type Vector struct {
	Vals    []*RegOrLabel `"{" @@ ( "," @@ )* "}"`
	Indexed *string       `@('[' Number ']')?`
}

Vector structure {v1.h, v2.h}

Jump to

Keyboard shortcuts

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