special

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package special provides Ale's special forms and compiler primitives that emit instructions during compilation. These include fundamental constructs like lambda and let, as well as namespace management.

Index

Constants

View Source
const (
	// ErrUnpairedBindings is raised when a Let binding Vector has fewer or
	// more than two elements
	ErrUnpairedBindings = "binding must be a paired vector"

	// ErrUnexpectedLetSyntax is raised when the Let bindings are not in the
	// form of a List or Vector
	ErrUnexpectedLetSyntax = "unexpected binding syntax: %s"

	// ErrNameAlreadyBound is raised when there's an attempt to bind the same
	// name more than once in a single Let scope
	ErrNameAlreadyBound = "name is already bound in local scope: %s"
)
View Source
const (
	ErrExpectedName     = "name expected, got %s"
	ErrUnexpectedImport = "unexpected import pattern: %s"
	ErrDuplicateName    = "duplicate name(s) in import: %s"
)

Variables

View Source
var (
	// Eval encodes an immediate evaluation
	Eval = makeEvaluator(eval.Value)

	// MacroExpand performs macro expansion of a form until it can no longer
	MacroExpand = makeEvaluator(macro.Expand)

	// MacroExpand1 performs a single-step macro expansion of a form
	MacroExpand1 = makeEvaluator(macro.Expand1)
)

Functions

func Asm

func Asm(e encoder.Encoder, args ...ale.Value) error

Asm provides indirect access to the Encoder's methods and generators

func Declared

func Declared(e encoder.Encoder, args ...ale.Value) error

func Import

func Import(e encoder.Encoder, args ...ale.Value) error

func Lambda

func Lambda(e encoder.Encoder, args ...ale.Value) error

Lambda encodes a lambda

func Let

func Let(e encoder.Encoder, args ...ale.Value) error

Let encodes a binding form. Binding values are evaluated first, and are then bound to fresh names, meaning that mutual recursion is not supported

func LetMutual

func LetMutual(e encoder.Encoder, args ...ale.Value) error

LetMutual encodes a binding form. First fresh names are introduced, and then binding values are evaluated with access to those names via the MutualScope

func MakeNamespace

func MakeNamespace(e encoder.Encoder, args ...ale.Value) error

func Special

func Special(e encoder.Encoder, args ...ale.Value) error

Special emits an encoder function for the provided param cases

Types

This section is empty.

Jump to

Keyboard shortcuts

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