github.com/neugram/ng@v0.0.0-20180309130942-d472ff93d872/syntax/syntax.go (about) 1 // Copyright 2017 The Neugram Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package syntax defines an Abstract Syntax Tree, an AST, for Neugram. 6 // 7 // Nodes in the AST are represented by Node objects. The particular nodes 8 // for expressions, statements, and types are defined in the respective 9 // packages: 10 // 11 // syntax/expr 12 // syntax/stmt 13 // syntax/tipe 14 // 15 package syntax 16 17 import ( 18 "neugram.io/ng/syntax/src" 19 "neugram.io/ng/syntax/stmt" 20 ) 21 22 // A Node is a node in the syntax tree. 23 type Node interface { 24 Pos() src.Pos 25 } 26 27 // File is the syntax tree of a Neugram file. 28 type File struct { 29 Filename string 30 Stmts []stmt.Stmt 31 } 32 33 func (f File) Pos() src.Pos { return src.Pos{Filename: f.Filename} }