xml-programming/cmd/main.go
overflowerror 6ad0168eaf initial commit
I wrote this a few year back (according to the mtime of the files
Sep 12th 2021)
2024-02-02 22:02:20 +01:00

38 lines
No EOL
582 B
Go

package main
import (
"flag"
"io"
"os"
"xml-programming/internal/analysis"
"xml-programming/internal/parser"
"xml-programming/internal/vm"
)
func main() {
flag.Parse()
filename := flag.Arg(0)
file, err := os.Open(filename)
if err != nil {
panic(err)
}
content, err := io.ReadAll(file)
if err != nil {
panic(err)
}
program, err := parser.Parse(content)
if err != nil {
panic(err)
}
//json, _ := json.MarshalIndent(program, "", " ")
//fmt.Println(string(json))
err = analysis.StaticAnalysis(program)
if err != nil {
panic(err)
}
vm.Run(program)
}