refactor: rename interpreter to runtime and use receiver methods

- Rename pkg/interpreter to pkg/runtime
- Move ReduceOnce to new pkg/normalorder package
- Convert standalone functions (Substitute, Rename, GetFree, IsFree)
  to receiver methods on concrete expression types
- Change Set from pointer receivers to value receivers
- Update all references from interpreter to runtime terminology

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-18 15:11:04 -05:00
parent e85cf7ceff
commit d715d38e9e
26 changed files with 200 additions and 196 deletions

View File

@@ -19,7 +19,7 @@ func convertAbstraction(n *saccharine.Abstraction) lambda.Expression {
// If the function has no parameters, it is a thunk. Lambda calculus still
// requires _some_ parameter exists, so generate one.
if len(parameters) == 0 {
freeVars := lambda.GetFreeVariables(result)
freeVars := result.GetFree()
freshName := lambda.GenerateFreshName(freeVars)
parameters = append(parameters, freshName)
}
@@ -63,7 +63,7 @@ func reduceLet(s *saccharine.LetStatement, e lambda.Expression) lambda.Expressio
}
func reduceDeclare(s *saccharine.DeclareStatement, e lambda.Expression) lambda.Expression {
freshVar := lambda.GenerateFreshName(lambda.GetFreeVariables(e))
freshVar := lambda.GenerateFreshName(e.GetFree())
return lambda.NewApplication(
lambda.NewAbstraction(freshVar, e),