mirror of
https://github.com/golang/go
synced 2024-11-26 14:26:51 -07:00
c9edbbd4d0
R=austin DELTA=142 (128 added, 4 deleted, 10 changed) OCL=34275 CL=34284
38 lines
607 B
Go
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());
|
|
}
|
|
}
|
|
}
|
|
|