aboutsummaryrefslogtreecommitdiff
path: root/cer.go
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-08-30 09:17:43 +0200
committerHimbeer <himbeer@disroot.org>2024-08-30 09:17:43 +0200
commit3adfc2d52c29fd90257813f33b8286225f7adc04 (patch)
tree39e4d064af273fc1fc1e271a4f4a135a4227e102 /cer.go
Initial commit
Diffstat (limited to 'cer.go')
-rw-r--r--cer.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/cer.go b/cer.go
new file mode 100644
index 0000000..879ec4f
--- /dev/null
+++ b/cer.go
@@ -0,0 +1,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)
+}