wip: new folder structure, overhaul language

This commit is contained in:
2025-12-26 02:39:15 -05:00
parent 11e7f70625
commit d427703afe
10 changed files with 132 additions and 111 deletions

41
pkg/saccharine/ast.go Normal file
View File

@@ -0,0 +1,41 @@
package saccharine
type Node interface {
IsNode()
}
/** ------------------------------------------------------------------------- */
type Abstraction struct {
Parameters []string
Body Node
}
type Application struct {
Abstraction Node
Arguments []Node
}
type Variable struct {
Name string
}
/** ------------------------------------------------------------------------- */
func NewAbstraction(parameter []string, body Node) *Abstraction {
return &Abstraction{Parameters: parameter, Body: body}
}
func NewApplication(abstraction Node, arguments []Node) *Application {
return &Application{Abstraction: abstraction, Arguments: arguments}
}
func NewVariable(name string) *Variable {
return &Variable{Name: name}
}
/** ------------------------------------------------------------------------- */
func (_ Abstraction) IsNode() {}
func (_ Application) IsNode() {}
func (_ Variable) IsNode() {}