1
0
mirror of https://github.com/golang/go synced 2024-11-26 21:01:31 -07:00
go/usr/austin/eval/main.go
Russ Cox c9edbbd4d0 convenience wrapper
R=austin
DELTA=142  (128 added, 4 deleted, 10 changed)
OCL=34275
CL=34284
2009-09-02 17:15:43 -07:00

38 lines
607 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 main
import (
"./_obj/eval";
"bufio";
"os";
)
func main() {
w := eval.NewWorld();
r := bufio.NewReader(os.Stdin);
for {
print("; ");
line, err := r.ReadString('\n');
if err != nil {
break;
}
code, err := w.Compile(line);
if err != nil {
println(err.String());
continue;
}
v, err := code.Run();
if err != nil {
println(err.String());
continue;
}
if v != nil {
println(v.String());
}
}
}