func input(context *lisp1_5.Context, parser *lisp1_5.Parser, prompt string) {
	defer handler(context, parser)
	for {
		if prompt != "" && *doPrompt {
			fmt.Print(prompt)
		}
		switch parser.SkipSpace() {
		case '\n':
			continue
		case lisp1_5.EofRune:
			if !loading {
				os.Exit(0)
			}
			return
		}
		expr := context.Eval(parser.List())
		fmt.Println(expr)
		parser.SkipSpace()  
	}
}
input runs the parser to EOF.
package main  
import (
	"bufio"
	"flag"
	"fmt"
	"os"
	"robpike.io/lisp/lisp1_5"
)
var (
	printSExpr = flag.Bool("sexpr", false, "always print S-expressions")
	doPrompt   = flag.Bool("doprompt", true, "show interactive prompt")
	prompt     = flag.String("prompt", "> ", "interactive prompt")
	stackDepth = flag.Int("depth", 1e5, "maximum call depth; 0 means no limit")
)
var loading bool
func main() {
	flag.Parse()
	lisp1_5.Config(*printSExpr)
	context := lisp1_5.NewContext(*stackDepth)
	loading = true
	for _, file := range flag.Args() {
		load(context, file)
	}
	loading = false
	parser := lisp1_5.NewParser(bufio.NewReader(os.Stdin))
	for {
		input(context, parser, *prompt)
	}
}
func load(context *lisp1_5.Context, file string) {
	fd, err := os.Open(file)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	defer fd.Close()
	parser := lisp1_5.NewParser(bufio.NewReader(fd))
	input(context, parser, "")
}