syntax

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugString

func DebugString(diags []Diagnostic) string

DebugString renders diagnostics for tests and callers.

func EosGrammar

func EosGrammar() *grammargen.Grammar

EosGrammar returns the tree-sitter grammar for the Eos source language.

func Language

func Language() (*gotreesitter.Language, error)

Language returns the cached generated Eos tree-sitter language.

func Parse

func Parse(moduleName string, src []byte) (*File, []Diagnostic)

Parse parses Eos source into the compiler-facing AST.

func ParseTree

func ParseTree(src []byte) (*gotreesitter.Tree, *gotreesitter.Language, error)

ParseTree parses Eos source and returns the tree-sitter tree and language.

Types

type BinaryExpr

type BinaryExpr struct {
	Op    string
	Left  Expr
	Right Expr
	Span  Span
}

BinaryExpr is a binary operator expression.

func (*BinaryExpr) ExprSpan

func (e *BinaryExpr) ExprSpan() Span

type CallExpr

type CallExpr struct {
	Callee    string
	Intrinsic bool
	Args      []Expr
	Span      Span
}

CallExpr is a regular or intrinsic call.

func (*CallExpr) ExprSpan

func (e *CallExpr) ExprSpan() Span

type CallableDecl

type CallableDecl struct {
	Kind    CallableKind
	Name    string
	Params  []Field
	Result  TypeRef
	Results []Field
	Body    []Stmt
	Span    Span
}

CallableDecl is a kernel or pipeline declaration.

func (*CallableDecl) DeclSpan

func (d *CallableDecl) DeclSpan() Span

type CallableKind

type CallableKind string

CallableKind identifies a top-level callable declaration.

const (
	CallableKernel   CallableKind = "kernel"
	CallablePipeline CallableKind = "pipeline"
)

type Decl

type Decl interface {
	DeclSpan() Span
	// contains filtered or unexported methods
}

Decl is a top-level declaration.

type Diagnostic

type Diagnostic struct {
	Severity Severity
	Message  string
	Span     Span
}

Diagnostic records a compiler message tied to source.

type DimExpr

type DimExpr struct {
	Text string
	Span Span
}

DimExpr is a symbolic or literal dimension expression in v0.

type Expr

type Expr interface {
	ExprSpan() Span
	// contains filtered or unexported methods
}

Expr is an expression node.

type ExprStmt

type ExprStmt struct {
	Expr Expr
	Span Span
}

ExprStmt evaluates an expression for effect.

func (*ExprStmt) StmtSpan

func (s *ExprStmt) StmtSpan() Span

type Field

type Field struct {
	Name string
	Type TypeRef
	Span Span
}

Field is a named parameter or result binding.

type File

type File struct {
	ModuleName  string
	Source      []byte
	Decls       []Decl
	Diagnostics []Diagnostic
}

File is the parsed Eos source module.

type IdentExpr

type IdentExpr struct {
	Name string
	Span Span
}

IdentExpr references a named value.

func (*IdentExpr) ExprSpan

func (e *IdentExpr) ExprSpan() Span

type LetStmt

type LetStmt struct {
	Name string
	Expr Expr
	Span Span
}

LetStmt binds a local name.

func (*LetStmt) StmtSpan

func (s *LetStmt) StmtSpan() Span

type NumberExpr

type NumberExpr struct {
	Text string
	Span Span
}

NumberExpr is a numeric literal.

func (*NumberExpr) ExprSpan

func (e *NumberExpr) ExprSpan() Span

type ParamDecl

type ParamDecl struct {
	Name      string
	Type      TypeRef
	Binding   string
	Trainable bool
	Span      Span
}

ParamDecl declares an externally bound model parameter.

func (*ParamDecl) DeclSpan

func (d *ParamDecl) DeclSpan() Span

type ReturnStmt

type ReturnStmt struct {
	Expr  Expr
	Exprs []Expr
	Span  Span
}

ReturnStmt returns a value from the callable.

func (*ReturnStmt) StmtSpan

func (s *ReturnStmt) StmtSpan() Span

type Severity

type Severity string

Severity classifies a diagnostic.

const (
	SeverityError   Severity = "error"
	SeverityWarning Severity = "warning"
)

type Span

type Span struct {
	Start  int
	End    int
	Line   int
	Column int
}

Span identifies a byte range in source.

type Stmt

type Stmt interface {
	StmtSpan() Span
	// contains filtered or unexported methods
}

Stmt is a statement in a callable body.

type StringExpr

type StringExpr struct {
	Value string
	Span  Span
}

StringExpr is a string literal.

func (*StringExpr) ExprSpan

func (e *StringExpr) ExprSpan() Span

type TypeRef

type TypeRef struct {
	Name  string
	Shape []DimExpr
	Span  Span
}

TypeRef is a parsed type reference.

Jump to

Keyboard shortcuts

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