feat: expression

This commit is contained in:
2025-12-27 03:43:19 -05:00
parent bf0edfc593
commit 0e185fbf41
7 changed files with 50 additions and 15 deletions

View File

@@ -20,6 +20,10 @@ type Atom struct {
Name string
}
func (Abstraction) IsExpression() {}
func (Application) IsExpression() {}
func (Atom) IsExpression() {}
/** ------------------------------------------------------------------------- */
func NewAbstraction(parameter []string, body Expression) *Abstraction {
@@ -33,9 +37,3 @@ func NewApplication(abstraction Expression, arguments []Expression) *Application
func NewAtom(name string) *Atom {
return &Atom{Name: name}
}
/** ------------------------------------------------------------------------- */
func (a Abstraction) IsExpression() {}
func (a Application) IsExpression() {}
func (v Atom) IsExpression() {}

View File

@@ -0,0 +1,5 @@
package ast
type Program struct {
Statements []Statement
}

View File

@@ -0,0 +1,28 @@
package ast
type Statement interface {
IsStatement()
}
/** ------------------------------------------------------------------------- */
type LetStatement struct {
Variable string
Value Expression
}
type MethodStatement struct {
Name string
Parameters []string
Body Expression
}
type DeclareStatement struct {
Value Expression
}
func (LetStatement) IsStatement() {}
func (MethodStatement) IsStatement() {}
func (DeclareStatement) IsStatement() {}
/** ------------------------------------------------------------------------- */