elysium/main.go
2024-03-11 22:05:36 +01:00

33 lines
490 B
Go

// The compiler
package main
import (
"log"
"os"
)
func main() {
if len(os.Args) != 2 {
log.Fatalln("Usage: " + os.Args[0] + " <file>")
}
content, err := os.ReadFile(os.Args[1])
if err != nil {
log.Fatalln("Cannot open input file.", err)
}
tokens, err := lexer(string(content))
if err != nil {
log.Fatalln(err)
}
log.Printf("Tokens:\n%+#v\n\n", tokens)
parsed, err := parser(tokens)
if err != nil {
log.Fatalln(err)
}
log.Printf("Parsed:\n%+#v\n\n", parsed)
}