grammar

package
v0.0.0-...-9d7e182 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package grammar holds the JSON type definitions for the SPIR-V grammar schema.

See https://www.khronos.org/registry/spir-v/specs/unified1/MachineReadableGrammar.html for more information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enumerant

type Enumerant struct {
	Enumerant    string      `json:"enumerant"`
	Value        interface{} `json:"value"`
	Capabilities []string    `json:"capabilities"`
	Parameters   []Parameter `json:"parameters"`
	Version      string      `json:"version"`
}

Enumerant contains information about an enumerant in an enum.

type Instruction

type Instruction struct {
	Opname   string    `json:"opname"`
	Class    string    `json:"class"`
	Opcode   int       `json:"opcode"`
	Operands []Operand `json:"operands"`
}

Instruction holds information about a specific SPIR-V instruction.

type Operand

type Operand struct {
	Kind       string     `json:"kind"`
	Name       string     `json:"name"`
	Quantifier Quantifier `json:"quantifier"`
}

Operand contains information about a logical operand for an instruction.

type OperandKind

type OperandKind struct {
	Category   string      `json:"category"`
	Kind       string      `json:"kind"`
	Enumerants []Enumerant `json:"enumerants"`
	Bases      []string    `json:"bases"`
}

OperandKind contains information about a specific operand kind.

type Parameter

type Parameter struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
}

Parameter contains information about a logical parameter for an enumerant.

type Quantifier

type Quantifier string

Quantifier indicates the number of times the quantified term may appear.

const (
	// Once indicates the quantified term may appear exactly once.
	Once Quantifier = ""
	// ZeroOrOnce indicates the quantified term may appear zero or one
	// time; an optional term.
	ZeroOrOnce Quantifier = "?"
	// ZeroOrMany indicates the quantified term may appear any number of
	// times.
	ZeroOrMany Quantifier = "*"
)

type Root

type Root struct {
	MagicNumber  string        `json:"magic_number"`
	MajorVersion int           `json:"major_version"`
	MinorVersion int           `json:"minor_version"`
	Revision     int           `json:"revision"`
	Instructions []Instruction `json:"instructions"`
	OperandKinds []OperandKind `json:"operand_kinds"`
}

Root is the top-level structure of the JSON grammar.

Jump to

Keyboard shortcuts

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