aboutsummaryrefslogtreecommitdiff
path: root/main.go
blob: a4de7499c7e87f1af16d53df4c608bd8734f8e51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main

//go:generate -command yacc go tool yacc
//go:generate yacc -o parser.go parser.y

import (
	"bufio"
	"flag"
	"io"
	"os"
)

func init() {
	flag.IntVar(&yyDebug, "debug", 1, "debug level")
	flag.Parse()
}

func main() {
	in := bufio.NewReader(os.Stdin)
	for {
		os.Stdout.WriteString("      ")
		line, err := in.ReadString('\n')
		if err == io.EOF {
			return
		}
		yyParse(lex(line))
	}
}