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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
cer-bootstrap is the bootstrapping compiler for the Cer programming
language.
*/
package main
import (
"fmt"
"os"
"sync"
)
var wg sync.WaitGroup
func main() {
wg.Add(3)
errs := make(chan error)
go readErrs(errs)
toks := make(chan token, 1024)
go lex(os.Stdin, toks, errs)
// for token := range tokens {
// fmt.Println(token)
// }
root := make(chan *rootExpr, 1)
go parse(&tokens{
src: toks,
toks: make([]token, 0, len(toks)),
}, root, errs)
// fmt.Printf("%+v\n", <-expr)
go generate(<-root, os.Stdout, errs)
wg.Wait()
}
func readErrs(errs <-chan error) {
fmt.Fprintln(os.Stderr, <-errs)
os.Exit(1)
}
|