## Summary - Added doc comments across the codebase: `pkg/lambda`, `pkg/saccharine`, `pkg/codec`, `pkg/engine`, `pkg/iterator`, `pkg/set`, `pkg/convert`, `internal/registry`, and `cmd/lambda`. - Made lambda and saccharine expression structs use public fields instead of getters, matching `go/ast` conventions. - Removed superfluous constructors for saccharine and lambda expression/statement types in favor of struct literals. - Consolidated saccharine token constructors into a single `NewToken` function. - Removed the unused `trace` package. ## Test plan - [x] `go build ./...` passes. - [x] `go test ./...` passes. - [ ] Verify `go doc` output renders correctly for documented packages. Reviewed-on: #45 Co-authored-by: M.V. Hutz <git@maximhutz.me> Co-committed-by: M.V. Hutz <git@maximhutz.me>
19 lines
657 B
Go
19 lines
657 B
Go
// Package engine defines a general process of reducing a lambda calculus
|
|
// expression.
|
|
package engine
|
|
|
|
// A Process handles the reduction of a single expression.
|
|
type Process[T any] interface {
|
|
// Get the current state of the process.
|
|
// Returns an error if the current state cannot be represented.
|
|
Get() (T, error)
|
|
|
|
// Step performs reduction(s) on the representation. If the number of steps
|
|
// defined is less than zero, it will perform as many reductions as
|
|
// possible. Returns whether a reduction was performed.
|
|
Step(int) bool
|
|
}
|
|
|
|
// An Engine is an function that generates reduction processes.
|
|
type Engine[T any] = func(T) (Process[T], error)
|