This commit is contained in:
unintendedfraud
2024-03-19 13:37:31 +01:00
parent b210ae6115
commit 9a8e3690fe
2 changed files with 51 additions and 0 deletions
+19
View File
@@ -1,5 +1,7 @@
package ast
import "gointerpreter/token"
type Node interface {
TokenLiteral() string
}
@@ -25,3 +27,20 @@ func (p *Program) TokenLiteral() string {
return ""
}
type LetStatement struct {
Token token.Token
Name *Identifier
Value Expression
}
func (ls *LetStatement) statementNode() {}
func (ls *LetStatement) TokenLiteral() string { return ls.Token.Literal }
type Identifier struct {
Token token.Token
Value string
}
func (i *Identifier) expressionNode() {}
func (i *Identifier) TokenLiteral() string { return i.Token.Literal }