This commit is contained in:
unintendedfraud
2024-03-17 23:09:12 +01:00
commit b073f8f039
7 changed files with 411 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package ast
type Node interface {
TokenLiteral() string
}
type Statement interface {
Node
statementNode()
}
type Expression interface {
Node
expressionNode()
}
type Program struct {
Statements []Statement
}
func (p *Program) TokenLiteral() string {
if len(p.Statements) > 0 {
return p.Statements[0].TokenLiteral()
}
return ""
}