mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
21 lines
288 B
Go
21 lines
288 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
type AST struct {
|
|
Num int
|
|
Children []AST
|
|
}
|
|
|
|
func newAST(num int, root AST, children ...AST) AST {
|
|
return AST{num, append([]AST{root}, children...)}
|
|
}
|
|
|
|
func main() {
|
|
ast := newAST(1, AST{}, AST{})
|
|
fmt.Println(ast)
|
|
}
|
|
|
|
// Output:
|
|
// {1 [{0 []} {0 []}]}
|