go/usr/gri/pretty/ast.go
Robert Griesemer 81d7c51837 First cut at a Go pretty printer:
- code scavenged from Go-in-Go front-end (will merge back)
- using "symbol-table" free parsing to build AST
- no printing yet

R=r
OCL=15504
CL=15504
2008-09-18 16:58:37 -07:00

40 lines
609 B
Go

// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package AST;
export type Expr interface {
pos() int;
print();
}
export type Stat interface {
pos() int;
print();
}
// ---------------------------------------------------------------------
// Concrete nodes
export type Ident struct {
pos_ int;
val_ string;
}
func (p *Ident) pos() int {
return p.pos_;
}
func (p *Ident) print() {
print("x"); // TODO fix this
}
// TODO: complete this