Documentation
¶
Index ¶
- Variables
- func IsMaybe(t Type) bool
- type And
- type AsyncPkg
- type Block
- type BoolLiteral
- type BoolMatch
- type BoolMethod
- type BoolMethodKind
- type Checker
- type ConditionalCase
- type ConditionalMatch
- type CopyExpression
- type Diagnostic
- type DiagnosticKind
- type EmbeddedModule
- type Enum
- type EnumMatch
- type EnumValue
- type EnumVariant
- type Equality
- type Expression
- type ExternalFunctionDef
- type FiberEval
- type FiberExecution
- type FloatAddition
- type FloatDivision
- type FloatGreater
- type FloatGreaterEqual
- type FloatLess
- type FloatLessEqual
- type FloatLiteral
- type FloatMethod
- type FloatMethodKind
- type FloatMultiplication
- type FloatSubtraction
- type ForInList
- type ForInMap
- type ForInStr
- type ForIntRange
- type ForLoop
- type FunctionCall
- type FunctionDef
- type GenericContext
- type Identifier
- type If
- type InstanceMethod
- type InstanceProperty
- type IntAddition
- type IntDivision
- type IntGreater
- type IntGreaterEqual
- type IntLess
- type IntLessEqual
- type IntLiteral
- type IntMatch
- type IntMethod
- type IntMethodKind
- type IntModulo
- type IntMultiplication
- type IntRange
- type IntSubtraction
- type List
- type ListLiteral
- type ListMethod
- type ListMethodKind
- type Map
- type MapLiteral
- type MapMethod
- type MapMethodKind
- type Match
- type Maybe
- type MaybeMethod
- type MaybeMethodKind
- type MaybePkg
- type Module
- type ModuleFunctionCall
- type ModuleResolver
- func (mr *ModuleResolver) GetProjectInfo() *ProjectInfo
- func (mr *ModuleResolver) LoadModule(importPath string) (*parse.Program, error)
- func (mr *ModuleResolver) LoadModuleWithDependencies(importPath string) (*parse.Program, error)
- func (mr *ModuleResolver) ResolveImportPath(importPath string) (string, error)
- type ModuleStructInstance
- type ModuleSymbol
- type Negation
- type NonProducing
- type Not
- type OptionMatch
- type Or
- type Panic
- type Parameter
- type Program
- type ProjectInfo
- type Reassignment
- type Result
- type ResultMatch
- type ResultMethod
- type ResultMethodKind
- type ResultPkg
- type Statement
- type StrAddition
- type StrLiteral
- type StrMethod
- type StrMethodKind
- type StructDef
- type StructInstance
- type SubjectKind
- type Symbol
- type SymbolTable
- type TemplateStr
- type Trait
- type TryKind
- type TryOp
- type Type
- type TypeVar
- type Union
- type UnionMatch
- type UserModule
- type Variable
- type VariableDef
- type VoidLiteral
- type WhileLoop
Constants ¶
This section is empty.
Variables ¶
var Bool = &_bool{}
var Dynamic = &dynamicType{}
var Float = &float{}
var Int = &_int{}
var Str = &str{}
var Void = &void{}
Functions ¶
Types ¶
type BoolLiteral ¶
type BoolLiteral struct {
Value bool
}
func (*BoolLiteral) String ¶
func (b *BoolLiteral) String() string
func (*BoolLiteral) Type ¶
func (b *BoolLiteral) Type() Type
type BoolMatch ¶
type BoolMatch struct {
Subject Expression
True *Block
False *Block
}
type BoolMethod ¶ added in v0.3.0
type BoolMethod struct {
Subject Expression
Kind BoolMethodKind
}
func (*BoolMethod) Type ¶ added in v0.3.0
func (m *BoolMethod) Type() Type
type BoolMethodKind ¶ added in v0.3.0
type BoolMethodKind uint8
const (
BoolToStr BoolMethodKind = iota
)
type Checker ¶ added in v0.3.0
type Checker struct {
// contains filtered or unexported fields
}
func New ¶ added in v0.3.0
func New(filePath string, input *parse.Program, moduleResolver *ModuleResolver) *Checker
func (*Checker) Diagnostics ¶ added in v0.3.0
func (c *Checker) Diagnostics() []Diagnostic
type ConditionalCase ¶
type ConditionalCase struct {
Condition Expression // Must be type Bool
Body *Block
}
type ConditionalMatch ¶
type ConditionalMatch struct {
Cases []ConditionalCase
CatchAll *Block
}
func (*ConditionalMatch) Type ¶
func (c *ConditionalMatch) Type() Type
type CopyExpression ¶
type CopyExpression struct {
Expr Expression
Type_ Type
}
func (*CopyExpression) Type ¶
func (c *CopyExpression) Type() Type
type Diagnostic ¶
type Diagnostic struct {
Kind DiagnosticKind
Message string
// contains filtered or unexported fields
}
func (Diagnostic) String ¶
func (d Diagnostic) String() string
type DiagnosticKind ¶
type DiagnosticKind string
const ( Error DiagnosticKind = "error" Warn DiagnosticKind = "warn" )
type EmbeddedModule ¶
type EmbeddedModule struct {
// contains filtered or unexported fields
}
EmbeddedModule represents a standard library module loaded from embedded .ard files
func (EmbeddedModule) Get ¶
func (m EmbeddedModule) Get(name string) Symbol
func (EmbeddedModule) Path ¶
func (m EmbeddedModule) Path() string
func (EmbeddedModule) Program ¶
func (m EmbeddedModule) Program() *Program
type Enum ¶
type Enum struct {
Name string
Private bool
Values []EnumValue // The discriminant values for each variant
Methods map[string]*FunctionDef
Traits []*Trait
Location parse.Location
}
func (Enum) NonProducing ¶
func (e Enum) NonProducing()
type EnumMatch ¶
type EnumMatch struct {
Subject Expression
Cases []*Block
CatchAll *Block
}
type EnumVariant ¶
type EnumVariant struct {
Variant int8
// contains filtered or unexported fields
}
func (EnumVariant) String ¶
func (ev EnumVariant) String() string
func (EnumVariant) Type ¶
func (ev EnumVariant) Type() Type
type Equality ¶
type Equality struct {
Left, Right Expression
}
type Expression ¶
type Expression interface {
Type() Type
}
type ExternalFunctionDef ¶
type ExternalFunctionDef struct {
Name string
Parameters []Parameter
ReturnType Type
ExternalBinding string
Private bool
}
func (ExternalFunctionDef) String ¶
func (e ExternalFunctionDef) String() string
func (*ExternalFunctionDef) Type ¶
func (e *ExternalFunctionDef) Type() Type
type FiberEval ¶ added in v0.4.0
type FiberEval struct {
// contains filtered or unexported fields
}
func (FiberEval) GetFn ¶ added in v0.4.0
func (f FiberEval) GetFn() Expression
type FiberExecution ¶
type FiberExecution struct {
// contains filtered or unexported fields
}
func (FiberExecution) GetMainName ¶
func (f FiberExecution) GetMainName() string
func (FiberExecution) GetModule ¶
func (f FiberExecution) GetModule() Module
func (FiberExecution) Type ¶
func (f FiberExecution) Type() Type
type FloatAddition ¶
type FloatAddition struct {
Left Expression
Right Expression
}
func (*FloatAddition) Type ¶
func (n *FloatAddition) Type() Type
type FloatDivision ¶
type FloatDivision struct {
Left Expression
Right Expression
}
func (*FloatDivision) Type ¶
func (n *FloatDivision) Type() Type
type FloatGreater ¶
type FloatGreater struct {
Left Expression
Right Expression
}
func (*FloatGreater) Type ¶
func (n *FloatGreater) Type() Type
type FloatGreaterEqual ¶
type FloatGreaterEqual struct {
Left Expression
Right Expression
}
func (*FloatGreaterEqual) Type ¶
func (n *FloatGreaterEqual) Type() Type
type FloatLess ¶
type FloatLess struct {
Left Expression
Right Expression
}
type FloatLessEqual ¶
type FloatLessEqual struct {
Left Expression
Right Expression
}
func (*FloatLessEqual) Type ¶
func (n *FloatLessEqual) Type() Type
type FloatLiteral ¶
type FloatLiteral struct {
Value float64
}
func (*FloatLiteral) String ¶
func (f *FloatLiteral) String() string
func (*FloatLiteral) Type ¶
func (f *FloatLiteral) Type() Type
type FloatMethod ¶ added in v0.3.0
type FloatMethod struct {
Subject Expression
Kind FloatMethodKind
}
func (*FloatMethod) Type ¶ added in v0.3.0
func (m *FloatMethod) Type() Type
type FloatMethodKind ¶ added in v0.3.0
type FloatMethodKind uint8
const ( FloatToStr FloatMethodKind = iota FloatToInt )
type FloatMultiplication ¶
type FloatMultiplication struct {
Left Expression
Right Expression
}
func (*FloatMultiplication) Type ¶
func (n *FloatMultiplication) Type() Type
type FloatSubtraction ¶
type FloatSubtraction struct {
Left Expression
Right Expression
}
func (*FloatSubtraction) Type ¶
func (n *FloatSubtraction) Type() Type
type ForInList ¶
type ForInList struct {
Cursor string
Index string
List Expression
Body *Block
}
func (ForInList) NonProducing ¶
func (f ForInList) NonProducing()
type ForInMap ¶
type ForInMap struct {
Key string
Val string
Map Expression
Body *Block
}
func (ForInMap) NonProducing ¶
func (f ForInMap) NonProducing()
type ForInStr ¶
type ForInStr struct {
Cursor string
Index string
Value Expression
Body *Block
}
func (ForInStr) NonProducing ¶
func (f ForInStr) NonProducing()
type ForIntRange ¶
type ForIntRange struct {
Cursor string
Index string
Start Expression
End Expression
Body *Block
}
func (ForIntRange) NonProducing ¶
func (f ForIntRange) NonProducing()
type ForLoop ¶
type ForLoop struct {
Init *VariableDef
Condition Expression
Update *Reassignment
Body *Block
}
func (ForLoop) NonProducing ¶
func (f ForLoop) NonProducing()
type FunctionCall ¶
type FunctionCall struct {
Name string
Args []Expression
// contains filtered or unexported fields
}
func CreateCall ¶
func CreateCall(name string, args []Expression, fn FunctionDef) *FunctionCall
func (*FunctionCall) Type ¶
func (f *FunctionCall) Type() Type
type FunctionDef ¶
type FunctionDef struct {
Name string
Parameters []Parameter
ReturnType Type
Mutates bool
Body *Block
Private bool
}
func (FunctionDef) String ¶
func (f FunctionDef) String() string
func (*FunctionDef) Type ¶
func (f *FunctionDef) Type() Type
type GenericContext ¶
GenericContext maps generic parameter names to their TypeVar instances The TypeVar instances are mutable - binding happens by setting TypeVar.actual and TypeVar.bound
type Identifier ¶
type Identifier struct {
Name string
// contains filtered or unexported fields
}
func (*Identifier) Type ¶
func (i *Identifier) Type() Type
type InstanceMethod ¶
type InstanceMethod struct {
Subject Expression
Method *FunctionCall
}
func (*InstanceMethod) String ¶ added in v0.3.0
func (i *InstanceMethod) String() string
func (*InstanceMethod) Type ¶
func (i *InstanceMethod) Type() Type
type InstanceProperty ¶
type InstanceProperty struct {
Subject Expression
Property string
Kind SubjectKind // Pre-computed by checker based on subject type
// contains filtered or unexported fields
}
func (*InstanceProperty) String ¶
func (i *InstanceProperty) String() string
String returns a string representation of the instance property
func (*InstanceProperty) Type ¶
func (i *InstanceProperty) Type() Type
type IntAddition ¶
type IntAddition struct {
Left Expression
Right Expression
}
func (*IntAddition) Type ¶
func (n *IntAddition) Type() Type
type IntDivision ¶
type IntDivision struct {
Left Expression
Right Expression
}
func (*IntDivision) Type ¶
func (n *IntDivision) Type() Type
type IntGreater ¶
type IntGreater struct {
Left Expression
Right Expression
}
func (*IntGreater) Type ¶
func (n *IntGreater) Type() Type
type IntGreaterEqual ¶
type IntGreaterEqual struct {
Left Expression
Right Expression
}
func (*IntGreaterEqual) Type ¶
func (n *IntGreaterEqual) Type() Type
type IntLess ¶
type IntLess struct {
Left Expression
Right Expression
}
type IntLessEqual ¶
type IntLessEqual struct {
Left Expression
Right Expression
}
func (*IntLessEqual) Type ¶
func (n *IntLessEqual) Type() Type
type IntLiteral ¶
type IntLiteral struct {
Value int
}
func (*IntLiteral) String ¶
func (i *IntLiteral) String() string
func (*IntLiteral) Type ¶
func (i *IntLiteral) Type() Type
type IntMatch ¶
type IntMethod ¶ added in v0.3.0
type IntMethod struct {
Subject Expression
Kind IntMethodKind
}
type IntMethodKind ¶ added in v0.3.0
type IntMethodKind uint8
const (
IntToStr IntMethodKind = iota
)
type IntModulo ¶
type IntModulo struct {
Left Expression
Right Expression
}
type IntMultiplication ¶
type IntMultiplication struct {
Left Expression
Right Expression
}
func (*IntMultiplication) Type ¶
func (n *IntMultiplication) Type() Type
type IntSubtraction ¶
type IntSubtraction struct {
Left Expression
Right Expression
}
func (*IntSubtraction) Type ¶
func (n *IntSubtraction) Type() Type
type ListLiteral ¶
type ListLiteral struct {
Elements []Expression
// contains filtered or unexported fields
}
func (*ListLiteral) Type ¶
func (l *ListLiteral) Type() Type
type ListMethod ¶ added in v0.3.0
type ListMethod struct {
Subject Expression
Kind ListMethodKind
Args []Expression
ElementType Type // Pre-computed element type
// contains filtered or unexported fields
}
func (*ListMethod) Type ¶ added in v0.3.0
func (m *ListMethod) Type() Type
type ListMethodKind ¶ added in v0.3.0
type ListMethodKind uint8
const ( ListAt ListMethodKind = iota ListPrepend ListPush ListSet ListSize ListSort ListSwap )
type MapLiteral ¶
type MapLiteral struct {
Keys []Expression
Values []Expression
KeyType Type // Pre-computed by checker
ValueType Type // Pre-computed by checker
// contains filtered or unexported fields
}
func (*MapLiteral) Type ¶
func (m *MapLiteral) Type() Type
type MapMethod ¶ added in v0.3.0
type MapMethod struct {
Subject Expression
Kind MapMethodKind
Args []Expression
KeyType Type // Pre-computed key type
ValueType Type // Pre-computed value type
// contains filtered or unexported fields
}
type MapMethodKind ¶ added in v0.3.0
type MapMethodKind uint8
const ( MapKeys MapMethodKind = iota MapSize MapGet MapSet MapDrop MapHas )
type Match ¶
type Match struct {
Pattern *Identifier
Body *Block
}
type MaybeMethod ¶ added in v0.3.0
type MaybeMethod struct {
Subject Expression
Kind MaybeMethodKind
Args []Expression
InnerType Type // Pre-computed inner type
// contains filtered or unexported fields
}
func (*MaybeMethod) Type ¶ added in v0.3.0
func (m *MaybeMethod) Type() Type
type MaybeMethodKind ¶ added in v0.3.0
type MaybeMethodKind uint8
const ( MaybeExpect MaybeMethodKind = iota MaybeIsNone MaybeIsSome MaybeOr )
type Module ¶
func FindEmbeddedModule ¶
findEmbeddedModule loads a .ard standard library module from embedded files
type ModuleFunctionCall ¶
type ModuleFunctionCall struct {
Module string
Call *FunctionCall
}
func (*ModuleFunctionCall) Type ¶
func (p *ModuleFunctionCall) Type() Type
type ModuleResolver ¶
type ModuleResolver struct {
// contains filtered or unexported fields
}
ModuleResolver handles finding and loading user modules
func NewModuleResolver ¶
func NewModuleResolver(workingDir string) (*ModuleResolver, error)
NewModuleResolver creates a new module resolver for the given working directory
func (*ModuleResolver) GetProjectInfo ¶
func (mr *ModuleResolver) GetProjectInfo() *ProjectInfo
GetProjectInfo returns the current project information
func (*ModuleResolver) LoadModule ¶
func (mr *ModuleResolver) LoadModule(importPath string) (*parse.Program, error)
LoadModule loads and parses a module file from the given import path
func (*ModuleResolver) LoadModuleWithDependencies ¶
func (mr *ModuleResolver) LoadModuleWithDependencies(importPath string) (*parse.Program, error)
LoadModuleWithDependencies loads a module and all its dependencies, detecting circular dependencies
func (*ModuleResolver) ResolveImportPath ¶
func (mr *ModuleResolver) ResolveImportPath(importPath string) (string, error)
ResolveImportPath converts an import path to a file system path Example: "my_project/utils" -> "utils.ard" Example: "my_project/math/operations" -> "math/operations.ard"
type ModuleStructInstance ¶
type ModuleStructInstance struct {
Module string
Property *StructInstance
FieldTypes map[string]Type // Pre-computed by checker
}
func (*ModuleStructInstance) Type ¶
func (p *ModuleStructInstance) Type() Type
type ModuleSymbol ¶
func (*ModuleSymbol) Type ¶
func (p *ModuleSymbol) Type() Type
type Negation ¶
type Negation struct {
Value Expression
}
type NonProducing ¶
type NonProducing interface {
NonProducing()
}
type Not ¶
type Not struct {
Value Expression
}
type OptionMatch ¶
type OptionMatch struct {
Subject Expression
Some *Match
None *Block
InnerType Type // Pre-computed inner type of Maybe
}
func (*OptionMatch) Type ¶
func (o *OptionMatch) Type() Type
type Panic ¶
type Panic struct {
Message Expression
// contains filtered or unexported fields
}
func (Panic) GetLocation ¶
type ProjectInfo ¶
type ProjectInfo struct {
RootPath string // absolute path to project root
ProjectName string // project name from ard.toml or directory name
}
ProjectInfo holds information about the current project
type Reassignment ¶
type Reassignment struct {
Target Expression
Value Expression
}
func (*Reassignment) NonProducing ¶
func (r *Reassignment) NonProducing()
func (*Reassignment) Type ¶ added in v0.3.0
func (r *Reassignment) Type() Type
type ResultMatch ¶
type ResultMatch struct {
Subject Expression
Ok *Match
Err *Match
}
func (ResultMatch) Type ¶
func (r ResultMatch) Type() Type
type ResultMethod ¶ added in v0.3.0
type ResultMethod struct {
Subject Expression
Kind ResultMethodKind
Args []Expression
OkType Type // Pre-computed OK type
ErrType Type // Pre-computed Error type
// contains filtered or unexported fields
}
func (*ResultMethod) Type ¶ added in v0.3.0
func (m *ResultMethod) Type() Type
type ResultMethodKind ¶ added in v0.3.0
type ResultMethodKind uint8
const ( ResultExpect ResultMethodKind = iota ResultOr ResultIsOk ResultIsErr )
type Statement ¶
type Statement struct {
Break bool
Expr Expression
Stmt NonProducing
}
can either produce a value or not
type StrAddition ¶
type StrAddition struct {
Left Expression
Right Expression
}
func (*StrAddition) Type ¶
func (n *StrAddition) Type() Type
type StrLiteral ¶
type StrLiteral struct {
Value string
}
func (*StrLiteral) String ¶
func (s *StrLiteral) String() string
func (*StrLiteral) Type ¶
func (s *StrLiteral) Type() Type
type StrMethod ¶ added in v0.3.0
type StrMethod struct {
Subject Expression
Kind StrMethodKind
Args []Expression
}
type StrMethodKind ¶ added in v0.3.0
type StrMethodKind uint8
const ( StrSize StrMethodKind = iota StrIsEmpty StrContains StrReplace StrReplaceAll StrSplit StrStartsWith StrToStr StrTrim )
type StructDef ¶
type StructDef struct {
Name string
Fields map[string]Type
Methods map[string]*FunctionDef
Self string
Traits []*Trait
Private bool
}
func (StructDef) NonProducing ¶
func (def StructDef) NonProducing()
type StructInstance ¶
type StructInstance struct {
Name string
Fields map[string]Expression
FieldTypes map[string]Type // Pre-computed by checker
// contains filtered or unexported fields
}
func (StructInstance) Type ¶
func (s StructInstance) Type() Type
type SubjectKind ¶ added in v0.3.0
type SubjectKind uint8
const (
StructSubject SubjectKind = iota
)
type SymbolTable ¶
type SymbolTable struct {
// contains filtered or unexported fields
}
type TemplateStr ¶
type TemplateStr struct {
Chunks []Expression
}
func (*TemplateStr) String ¶
func (t *TemplateStr) String() string
func (*TemplateStr) Type ¶
func (t *TemplateStr) Type() Type
type Trait ¶
type Trait struct {
Name string
// contains filtered or unexported fields
}
func (Trait) GetMethods ¶
func (t Trait) GetMethods() []FunctionDef
type TryOp ¶
type TryOp struct {
CatchBlock *Block
CatchVar string
Kind TryKind // Pre-computed by checker: TryResult or TryMaybe
// contains filtered or unexported fields
}
func (TryOp) Expr ¶
func (t TryOp) Expr() Expression
type Union ¶
func (Union) NonProducing ¶
func (u Union) NonProducing()
type UnionMatch ¶
type UnionMatch struct {
Subject Expression
TypeCases map[string]*Match
CatchAll *Block
}
func (*UnionMatch) Type ¶
func (u *UnionMatch) Type() Type
type UserModule ¶
type UserModule struct {
// contains filtered or unexported fields
}
UserModule represents a user-defined module that implements the Module interface
func NewUserModule ¶
func NewUserModule(filePath string, program *Program, globalScope *SymbolTable) *UserModule
NewUserModule creates a UserModule from a checked program, extracting only public symbols
func (*UserModule) Get ¶
func (m *UserModule) Get(name string) Symbol
Get returns a public symbol by name, or nil if not found or private
func (*UserModule) Path ¶
func (m *UserModule) Path() string
Path returns the file path for this module
func (*UserModule) Program ¶
func (m *UserModule) Program() *Program
Program returns the checked program for this module
type VariableDef ¶
type VariableDef struct {
Mutable bool
Name string
Value Expression
// contains filtered or unexported fields
}
func (*VariableDef) NonProducing ¶
func (v *VariableDef) NonProducing()
func (*VariableDef) Type ¶
func (v *VariableDef) Type() Type
type VoidLiteral ¶
type VoidLiteral struct{}
func (*VoidLiteral) String ¶
func (v *VoidLiteral) String() string
func (*VoidLiteral) Type ¶
func (v *VoidLiteral) Type() Type
type WhileLoop ¶
type WhileLoop struct {
Condition Expression
Body *Block
}
func (WhileLoop) NonProducing ¶
func (w WhileLoop) NonProducing()