compiler

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eval

func Eval(src string) (vm.Value, error)

func ReadString

func ReadString(s string) (vm.Value, error)

ReadString parses a string into a let-go Value.

Types

type CompileError

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

func NewCompileError

func NewCompileError(message string) *CompileError

func NewCompileErrorWithSource

func NewCompileErrorWithSource(message string, info *vm.SourceInfo) *CompileError

func (*CompileError) Error

func (r *CompileError) Error() string

func (*CompileError) GetCause

func (r *CompileError) GetCause() error

func (*CompileError) InnermostMessage

func (r *CompileError) InnermostMessage() string

InnermostMessage walks the error chain and returns the deepest error message.

func (*CompileError) InnermostSource

func (r *CompileError) InnermostSource() *vm.SourceInfo

InnermostSource walks the error chain and returns the deepest source info found.

func (*CompileError) Source

func (r *CompileError) Source() *vm.SourceInfo

func (*CompileError) Wrap

func (r *CompileError) Wrap(err error) errors.Error

type Context

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

func NewCompiler

func NewCompiler(consts *vm.Consts, ns *vm.Namespace) *Context

func NewDebugCompiler

func NewDebugCompiler(consts *vm.Consts, ns *vm.Namespace) *Context

func (*Context) Compile

func (c *Context) Compile(s string) (*vm.CodeChunk, error)

func (*Context) CompileMultiple

func (c *Context) CompileMultiple(reader io.Reader) (*vm.CodeChunk, vm.Value, error)

func (*Context) Consts

func (c *Context) Consts() *vm.Consts

func (*Context) CurrentNS

func (c *Context) CurrentNS() *vm.Namespace

func (*Context) SetCurrentNS

func (c *Context) SetCurrentNS(ns *vm.Namespace)

func (*Context) SetSource

func (c *Context) SetSource(source string) *Context

type LispReader

type LispReader struct {
	Tokens []Token
	// contains filtered or unexported fields
}

func NewLispReader

func NewLispReader(r io.Reader, inputName string) *LispReader

func NewLispReaderTokenizing

func NewLispReaderTokenizing(r io.Reader, inputName string) *LispReader

func (*LispReader) Read

func (r *LispReader) Read() (vm.Value, error)

type ReaderError

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

func NewReaderError

func NewReaderError(r *LispReader, message string) *ReaderError

func (*ReaderError) Error

func (r *ReaderError) Error() string

func (*ReaderError) GetCause

func (r *ReaderError) GetCause() error

func (*ReaderError) IsEOF

func (r *ReaderError) IsEOF() bool

func (*ReaderError) Wrap

func (r *ReaderError) Wrap(err error) errors.Error

type Token

type Token struct {
	Start int
	End   int
	Kind  TokenKind
}

type TokenKind

type TokenKind int
const (
	TokenString TokenKind = iota
	TokenNumber
	TokenKeyword
	TokenSymbol
	TokenChar
	TokenSpecial
	TokenComment
	TokenPunctuation
)

Jump to

Keyboard shortcuts

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