Documentation ¶
Index ¶
- Constants
- Variables
- func Blue(s ...string) string
- func Bold(s ...string) string
- func DeferDyadicApplicationTypes(function DyadicFunction, x, y Expression) (DyadicFunction, Expression, Expression)
- func DeferMonadicApplicationTypes(function MonadicFunction, y Expression) (MonadicFunction, Expression)
- func Emit(env *Environment)
- func Error(parts ...string) er
- func Green(s ...string) string
- func IsConstant(e Expression) bool
- func IsMatrix(t Type) bool
- func IsVector(t Type) bool
- func Notify(parts ...string) er
- func Panic(err string, args ...interface{})
- func PilotEmit(env *Environment) (string, bool)
- func QueryAutoVector(atom, vec Type) bool
- func QueryCast(from, to Type) bool
- func Red(s ...string) string
- func Ref(s string) *string
- func VectorDepth(t Type) int
- func Verbose(parts ...string) er
- func VerifyClangVersion()
- func Warn(parts ...string) er
- func Yellow(s ...string) string
- type Alpha
- type AtomicType
- type Attribute
- type Bool
- type Callable
- type Cast
- type Char
- type DCallable
- type DyadicApplication
- type DyadicCallable
- type DyadicFunction
- type Environment
- func (env *Environment) AwareIntern(i palisade.Ident) (p Ident)
- func (env *Environment) FetchDVerb(v *palisade.Ident) DyadicFunction
- func (env *Environment) FetchDyadicCallable(v string) Callable
- func (env *Environment) FetchMVerb(v *palisade.Ident) MonadicFunction
- func (env *Environment) FetchMonadicCallable(v string) Callable
- func (env *Environment) FetchVerb(v *palisade.Ident) Expression
- func (env *Environment) Intern(f Function)
- func (env *Environment) InternBuiltins()
- func (e *Environment) Iterate() int
- func (e Environment) String() (s string)
- func (env *Environment) SubstantiateType(t palisade.Type) Type
- type Expression
- type Function
- type GenericType
- type Group
- type Ident
- type Int
- type MCallable
- type MonadicApplication
- type MonadicCallable
- type MonadicFunction
- type MonadicOperator
- type Morpheme
- type Omega
- type OperatorApplication
- type Real
- type String
- type StructType
- type Type
- type TypeGroup
- func (g TypeGroup) Equals(t Type) bool
- func (group TypeGroup) Has(typ Type) bool
- func (g TypeGroup) Intersection(t Group) Group
- func (g TypeGroup) IsAlgebraic() bool
- func (g TypeGroup) Kind() int
- func (g TypeGroup) Realise() types.Type
- func (s TypeGroup) Resolve(t Type) Type
- func (g TypeGroup) String() (s string)
- func (g TypeGroup) Union(t Group) Group
- func (TypeGroup) Universal() bool
- func (g TypeGroup) Width() int64
- type Universal
- func (g Universal) Equals(t Type) bool
- func (group Universal) Has(typ Type) bool
- func (g Universal) Intersection(t Group) Group
- func (g Universal) IsAlgebraic() bool
- func (g Universal) Kind() int
- func (g Universal) Realise() types.Type
- func (s Universal) Resolve(t Type) Type
- func (Universal) String() string
- func (g Universal) Union(t Group) Group
- func (Universal) Universal() bool
- func (g Universal) Width() int64
- type Value
- type Vector
- type VectorType
- type Void
Constants ¶
const ( TypeKindAtomic = iota TypeKindVector TypeKindStruct TypeKindSemiDetermined TypeKindGroup TypeKindSemiDeterminedGroup KindMapOperator KindReduceOperator TypeInt TypeReal TypeChar TypeBool TypeVoid TypeString )
const CT_OOB = "Index %d overflows %s of length %d"
const CT_Unexpected = "Expected %s, instead found %s"
Variables ¶
var ( Numeric = TypeGroup{[]Type{RealType, IntType, CharType, BoolType}} Countable = TypeGroup{[]Type{IntType, CharType, BoolType}} )
var BoolType = AtomicType{ ID: TypeBool, WidthInBytes: 1, Name: ParseIdent("Bool"), Actual: types.I1, }
var CharType = AtomicType{ ID: TypeChar, WidthInBytes: 1, Name: ParseIdent("Char"), Actual: types.I8, }
var IntType = AtomicType{ ID: TypeInt, WidthInBytes: 8, Name: ParseIdent("Int"), Actual: types.I64, }
var RealType = AtomicType{ ID: TypeReal, WidthInBytes: 8, Name: ParseIdent("Real"), Actual: types.Double, }
var StringType = VectorType{Type: CharType}
var VoidType = AtomicType{ ID: TypeVoid, WidthInBytes: 0, Name: ParseIdent("Void"), Actual: types.Void, }
Functions ¶
func DeferDyadicApplicationTypes ¶
func DeferDyadicApplicationTypes(function DyadicFunction, x, y Expression) (DyadicFunction, Expression, Expression)
func DeferMonadicApplicationTypes ¶
func DeferMonadicApplicationTypes(function MonadicFunction, y Expression) (MonadicFunction, Expression)
func Emit ¶
func Emit(env *Environment)
Emit observes emit specifier and writes LLVM IR to file and invokes Clang Will exit.
func IsConstant ¶
func IsConstant(e Expression) bool
func PilotEmit ¶
func PilotEmit(env *Environment) (string, bool)
func QueryAutoVector ¶
func VectorDepth ¶
func VerifyClangVersion ¶
func VerifyClangVersion()
VerifyClangVersion ensures Clang is installed and at least v12
Types ¶
type AtomicType ¶
func (AtomicType) IsAlgebraic ¶
func (a AtomicType) IsAlgebraic() bool
Interface prism.Type algebraic predicate
func (AtomicType) Kind ¶
func (a AtomicType) Kind() int
func (AtomicType) Realise ¶
func (a AtomicType) Realise() types.Type
func (AtomicType) Resolve ¶
func (a AtomicType) Resolve(t Type) Type
Resolve composes Integrate with Derive, Should not be used on concrete types
func (AtomicType) Width ¶
func (a AtomicType) Width() int64
Interface prism.Type width for LLVM codegen
type Bool ¶
type Bool struct {
Value bool
}
type Cast ¶
type Cast struct { Value Expression ToType Type }
func RoundhouseCast ¶
func RoundhouseCast(from Expression, otherside Type, to Type) (res *Cast)
RoundhouseCast attempts to find a mapping from a type to a type within a sum from is the Expression to have it's type changed (note: this will change to a type if casting is re-implemented this way) otherside is the opposite-hand type (for DyadicFunctions only), used to give hint to is the function-side type which contains the sum type.
type Char ¶
type Char struct {
Value string
}
type DyadicApplication ¶
type DyadicApplication struct { Operator DyadicFunction Left Expression Right Expression }
func (DyadicApplication) String ¶
func (d DyadicApplication) String() string
String function for interface
type DyadicCallable ¶
type DyadicCallable struct { DCallable Attribute Attribute // contains filtered or unexported fields }
func (DyadicCallable) Arity ¶
func (DyadicCallable) Arity() int
func (DyadicCallable) Attrs ¶
func (d DyadicCallable) Attrs() Attribute
type DyadicFunction ¶
type DyadicFunction struct { Name Ident AlphaType Type OmegaType Type Returns Type PreBody *[]palisade.Expression Body []Expression Attribute Attribute }
func (DyadicFunction) Arity ¶
func (DyadicFunction) Arity() int
func (DyadicFunction) Attrs ¶
func (d DyadicFunction) Attrs() Attribute
func (DyadicFunction) Ident ¶
func (d DyadicFunction) Ident() Ident
func (DyadicFunction) LLVMise ¶
func (f DyadicFunction) LLVMise() string
func (DyadicFunction) String ¶
func (f DyadicFunction) String() (s string)
String function for interface
type Environment ¶
type Environment struct { Iter uint IsPilotRun bool LexResult *palisade.PalisadeResult // MonadicFunctions map[Ident]*MonadicFunction DyadicFunctions map[Ident]*DyadicFunction Types map[Ident]Type // EmitFormat string Output string Verbose bool Optimisation string File string // ApotheosisIter int EntryFunction MonadicFunction Module *ir.Module Block *ir.Block LLDyadicFunctions map[string]*ir.Func LLMonadicFunctions map[string]*ir.Func Specials map[string]*ir.Func LLMonadicCallables map[string]Callable LLDyadicCallables map[string]Callable CurrentFunction *ir.Func CurrentFunctionIR Expression PanicStrings map[string]*ir.Global }
func Init ¶
func Init(env *Environment) *Environment
func Lex ¶
func Lex(env *Environment) *Environment
func NewEnvironment ¶
func NewEnvironment() *Environment
func (*Environment) AwareIntern ¶
func (env *Environment) AwareIntern(i palisade.Ident) (p Ident)
func (*Environment) FetchDVerb ¶
func (env *Environment) FetchDVerb(v *palisade.Ident) DyadicFunction
func (*Environment) FetchDyadicCallable ¶
func (env *Environment) FetchDyadicCallable(v string) Callable
func (*Environment) FetchMVerb ¶
func (env *Environment) FetchMVerb(v *palisade.Ident) MonadicFunction
func (*Environment) FetchMonadicCallable ¶
func (env *Environment) FetchMonadicCallable(v string) Callable
func (*Environment) FetchVerb ¶
func (env *Environment) FetchVerb(v *palisade.Ident) Expression
func (*Environment) Intern ¶
func (env *Environment) Intern(f Function)
func (*Environment) InternBuiltins ¶
func (env *Environment) InternBuiltins()
func (*Environment) Iterate ¶
func (e *Environment) Iterate() int
func (Environment) String ¶
func (e Environment) String() (s string)
func (*Environment) SubstantiateType ¶
func (env *Environment) SubstantiateType(t palisade.Type) Type
type Expression ¶
func DelegateCast ¶
func DelegateCast(from Expression, to Type) Expression
type GenericType ¶
type GenericType struct{}
func (GenericType) IsAlgebraic ¶
func (s GenericType) IsAlgebraic() bool
Interface Type algebraic predicate
func (GenericType) Kind ¶
func (s GenericType) Kind() int
func (GenericType) Realise ¶
func (s GenericType) Realise() types.Type
func (GenericType) Resolve ¶
func (g GenericType) Resolve(t Type) Type
Resolve composes Integrate with Derive, Fills in sum/generic type based on a concrete type
func (GenericType) String ¶
func (s GenericType) String() string
type Ident ¶
func ParseIdent ¶
type Int ¶
type Int struct {
Value int64
}
type MonadicApplication ¶
type MonadicApplication struct { Operator MonadicFunction Operand Expression }
func (MonadicApplication) String ¶
func (m MonadicApplication) String() string
String function for interface
func (MonadicApplication) Type ¶
func (m MonadicApplication) Type() Type
Type property for interface
type MonadicCallable ¶
type MonadicCallable struct { MCallable Attribute Attribute // contains filtered or unexported fields }
func (MonadicCallable) Arity ¶
func (MonadicCallable) Arity() int
func (MonadicCallable) Attrs ¶
func (m MonadicCallable) Attrs() Attribute
type MonadicFunction ¶
type MonadicFunction struct { Name Ident OmegaType Type Returns Type PreBody *[]palisade.Expression Body []Expression Attribute Attribute }
func (MonadicFunction) Arity ¶
func (MonadicFunction) Arity() int
func (MonadicFunction) Attrs ¶
func (d MonadicFunction) Attrs() Attribute
func (MonadicFunction) Ident ¶
func (m MonadicFunction) Ident() Ident
func (MonadicFunction) LLVMise ¶
func (f MonadicFunction) LLVMise() string
func (MonadicFunction) String ¶
func (f MonadicFunction) String() (s string)
String function for interface
type MonadicOperator ¶
func (MonadicOperator) Ident ¶
func (do MonadicOperator) Ident() Ident
func (MonadicOperator) IsSpecial ¶
func (do MonadicOperator) IsSpecial() bool
func (MonadicOperator) LLVMise ¶
func (do MonadicOperator) LLVMise() string
func (MonadicOperator) ShouldInline ¶
func (do MonadicOperator) ShouldInline() bool
func (MonadicOperator) String ¶
func (do MonadicOperator) String() string
String function for interface
func (MonadicOperator) Type ¶
func (do MonadicOperator) Type() Type
Type property for interface
Operators each return a type dependant on a different input
type OperatorApplication ¶
type OperatorApplication struct { Op MonadicOperator Expr Expression }
func (OperatorApplication) String ¶
func (d OperatorApplication) String() string
func (OperatorApplication) Type ¶
func (d OperatorApplication) Type() Type
type Real ¶
type Real struct {
Value float64
}
type String ¶
type String struct {
Value string
}
type StructType ¶
type StructType struct {
FieldTypes []Type
}
func (StructType) IsAlgebraic ¶
func (s StructType) IsAlgebraic() (acc bool)
Interface Type algebraic predicate
func (StructType) Kind ¶
func (s StructType) Kind() int
func (StructType) Realise ¶
func (s StructType) Realise() types.Type
func (StructType) Resolve ¶
func (s StructType) Resolve(t Type) Type
Resolve composes Integrate with Derive, Fills in sum/generic type based on a concrete type
func (StructType) Width ¶
func (s StructType) Width() (acc int64)
Interface Type width for LLVM codegen
type Type ¶
type Type interface { Kind() int Width() int64 String() string Equals(Type) bool Realise() types.Type Resolve(Type) Type IsAlgebraic() bool }
type TypeGroup ¶
type TypeGroup struct {
Set []Type
}
func (TypeGroup) Intersection ¶
func (TypeGroup) IsAlgebraic ¶
type Universal ¶
type Universal struct{}
func (Universal) Intersection ¶
func (Universal) IsAlgebraic ¶
type Vector ¶
type Vector struct { ElementType VectorType Body *[]Expression }
type VectorType ¶
type VectorType struct {
Type
}
func (VectorType) IsAlgebraic ¶
func (a VectorType) IsAlgebraic() bool
Interface prism.Type algebraic predicate
func (VectorType) Kind ¶
func (v VectorType) Kind() int
func (VectorType) Realise ¶
func (v VectorType) Realise() types.Type
func (VectorType) Resolve ¶
func (v VectorType) Resolve(t Type) Type
Resolve composes Integrate with Derive, Fills in sum/generic type based on a concrete type
func (VectorType) SubIsVoid ¶
func (v VectorType) SubIsVoid() bool
func (VectorType) Width ¶
func (v VectorType) Width() int64
Interface prism.Type width for LLVM codegen