Documentation
¶
Index ¶
- func DumpAST(program *Program, modules map[string]*Module) string
- func NodePos(node Node) source.SourcePos
- func NodeType(node Node) string
- func Recover()
- func Traverse(node Node, pre, post func(n Node))
- func TraverseList[N Node](list []N, pre, post func(n Node))
- type Binding
- type Expression
- type Lambda
- type LambdaCase
- type Let
- type List
- type ListPattern
- type Module
- type Name
- type Node
- type NumberLiteral
- type Operation
- type Parser
- func (p *Parser) Accept(kind string) bool
- func (p *Parser) Consume() Token
- func (p *Parser) Expect(kind string) Token
- func (p *Parser) Is(kind string) bool
- func (p *Parser) ParseApplication() Expression
- func (p *Parser) ParseAtomic(mandatory bool) Expression
- func (p *Parser) ParseBinding() *Binding
- func (p *Parser) ParseExpression() Expression
- func (p *Parser) ParseLambdaCase() *LambdaCase
- func (p *Parser) ParseLet() *Let
- func (p *Parser) ParseModule() *Module
- func (p *Parser) ParseName() *Name
- func (p *Parser) ParseOperation() Expression
- func (p *Parser) ParseProgram() *Program
- func (p *Parser) ParseQualifiedName() Expression
- func (p *Parser) Peek(offset int) Token
- func (p *Parser) Pos() source.SourcePos
- func (p *Parser) PrevPos() source.SourcePos
- type Pattern
- type Program
- type QualifiedName
- type Resolution
- type ResolutionFact
- type ResolveKind
- type Resolver
- type StringLiteral
- type Token
- type TupleExpr
- type TuplePattern
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DumpAST ¶
DumpAST renders the program body followed by every imported module's bindings, modules in sorted order for a stable result.
func TraverseList ¶
Types ¶
type Binding ¶
type Binding struct {
Name *Name
Expression Expression
}
type Expression ¶
type Expression interface {
Node
// contains filtered or unexported methods
}
type Lambda ¶
type Lambda struct {
Cases []*LambdaCase
Start, End source.SourcePos
}
type LambdaCase ¶
type LambdaCase struct {
Pattern Pattern
Expression Expression
}
func (*LambdaCase) FirstPos ¶
func (x *LambdaCase) FirstPos() source.SourcePos
func (*LambdaCase) LastPos ¶
func (x *LambdaCase) LastPos() source.SourcePos
type List ¶
type List struct {
SubExpressions []Expression
Start, End source.SourcePos
}
type ListPattern ¶
func (*ListPattern) FirstPos ¶
func (x *ListPattern) FirstPos() source.SourcePos
func (*ListPattern) LastPos ¶
func (x *ListPattern) LastPos() source.SourcePos
type Module ¶
func ParseModule ¶
type NumberLiteral ¶
func (*NumberLiteral) FirstPos ¶
func (x *NumberLiteral) FirstPos() source.SourcePos
func (*NumberLiteral) LastPos ¶
func (x *NumberLiteral) LastPos() source.SourcePos
type Operation ¶
type Operation struct {
Operator string
Operands []Expression
}
type Parser ¶
func (*Parser) ParseApplication ¶
func (p *Parser) ParseApplication() Expression
func (*Parser) ParseAtomic ¶
func (p *Parser) ParseAtomic(mandatory bool) Expression
func (*Parser) ParseBinding ¶
func (*Parser) ParseExpression ¶
func (p *Parser) ParseExpression() Expression
func (*Parser) ParseLambdaCase ¶
func (p *Parser) ParseLambdaCase() *LambdaCase
func (*Parser) ParseModule ¶
func (*Parser) ParseOperation ¶
func (p *Parser) ParseOperation() Expression
func (*Parser) ParseProgram ¶
func (*Parser) ParseQualifiedName ¶
func (p *Parser) ParseQualifiedName() Expression
type Pattern ¶
type Pattern interface {
Node
// contains filtered or unexported methods
}
func ToPattern ¶
func ToPattern(expr Expression) Pattern
type Program ¶
type Program struct {
Imports []*Name
Body Expression
Start source.SourcePos
}
func ParseProgram ¶
type QualifiedName ¶
func (*QualifiedName) FirstPos ¶
func (x *QualifiedName) FirstPos() source.SourcePos
func (*QualifiedName) LastPos ¶
func (x *QualifiedName) LastPos() source.SourcePos
type Resolution ¶
type Resolution struct {
Errors int
Uses map[*Name]ResolutionFact
Quals map[*QualifiedName]*Binding
}
type ResolutionFact ¶
type ResolutionFact struct {
Kind ResolveKind
Def Node // The defining *Binding or *Name; nil for builtins
Module *Module // Set if Kind == ResolveModule
}
type ResolveKind ¶
type ResolveKind uint8
const ( ResolveLocal ResolveKind = iota ResolveModule ResolveBuiltin )
type StringLiteral ¶
func (*StringLiteral) FirstPos ¶
func (x *StringLiteral) FirstPos() source.SourcePos
func (*StringLiteral) LastPos ¶
func (x *StringLiteral) LastPos() source.SourcePos
type Token ¶
func LexContent ¶
type TupleExpr ¶
type TupleExpr struct {
SubExpressions []Expression
Start, End source.SourcePos
}
type TuplePattern ¶
func (*TuplePattern) FirstPos ¶
func (x *TuplePattern) FirstPos() source.SourcePos
func (*TuplePattern) LastPos ¶
func (x *TuplePattern) LastPos() source.SourcePos
Click to show internal directories.
Click to hide internal directories.