Implemented an abstract syntax tree

This commit is contained in:
Eduard Urbach 2024-06-30 22:54:59 +02:00
parent 3b29d4cdee
commit 8453273d73
Signed by: eduard
GPG key ID: 49226B848C78F6C8
28 changed files with 422 additions and 315 deletions

36
src/build/ast/AST.go Normal file
View file

@ -0,0 +1,36 @@
package ast
import (
"git.akyoto.dev/cli/q/src/build/expression"
"git.akyoto.dev/cli/q/src/build/token"
)
type Node interface{}
type AST []Node
type Assign struct {
Value *expression.Expression
Name token.Token
}
type Call struct {
Expression *expression.Expression
}
type Define struct {
Value *expression.Expression
Name token.Token
}
type If struct {
Condition *expression.Expression
Body AST
}
type Loop struct {
Body AST
}
type Return struct {
Value *expression.Expression
}