ast

package
v0.0.0-...-d27f951 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugPrintLocation

func DebugPrintLocation(node Node) string

func ToAst

func ToAst(input io.ReadSeeker) ([]byte, error)

Types

type Apply

type Apply struct {
	Info
	Name      string
	Callee    Node
	Arguments []Node
}

type EOF

type EOF error

type FloatLiteral

type FloatLiteral struct {
	Info
	Name  string
	Value float64
}

type Function

type Function struct {
	Info
	Name   string
	Params []*Type
	Body   []Node
}

type Info

type Info struct {
	Reader *reader.Reader
	Start  Position
	End    Position
}

func NewInfo

func NewInfo(r *reader.Reader, startTok *lex.Token, endTok *lex.Token) Info

func (Info) DebugLine

func (i Info) DebugLine() string

func (Info) GetInfo

func (i Info) GetInfo() Info

type IntLiteral

type IntLiteral struct {
	Info
	Name  string
	Value int
}

type Label

type Label struct {
	Info
	Name      string
	Of        string
	IsBuiltIn bool
}

type Node

type Node interface {
	GetInfo() Info
}

TODO: Get rid of Node, everything is a function, even ints and strings

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

TODO: Add a callback that accepts a func or a static global and adds it to the llvm module for JIT compilation.

func New

func New(scanner *lex.Scanner) *Parser

func (*Parser) DebugPrintTokenLocation

func (p *Parser) DebugPrintTokenLocation(tok *lex.Token) string

func (*Parser) Parse

func (p *Parser) Parse() ([]Node, error)

type Position

type Position struct {
	Offset int // Offset from the beginning of the file
	Line   int // Line number
	Column int // Column number
}

type StringLiteral

type StringLiteral struct {
	Info
	Name  string
	Value string
}

type Type

type Type struct {
	Info
	Name     string
	Values   []*Type
	Value    string
	CompTime bool
}

Jump to

Keyboard shortcuts

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