hylia/main.go

39 lines
673 B
Go
Raw Normal View History

package main
import (
"fmt"
"os"
"hylia/parser"
"hylia/compiler"
)
func main() {
if len(os.args) < 3 {
fmt.Println("Usage: hylia <input.hy> <output.html>")
return
}
inputFile := os.Args[1]
outputFile := os.Args[2]
fmt.Println("Processing input:", inputFile)
parsedElements, err := parser.ParseFile(inputFile)
if err != nil {
fmt.Println("ERROR! ", err)
return
}
htmlOutput, err := compiler.Compile(parsedElements)
if err != nil {
fmt.Println("ERROR! ", err)
return
}
err = os.WriteFile(outputFile, []byte(htmlOutput), 0644)
if err != nil {
fmt.Println("ERROR! ", err)
return
}
fmt.Println("SUCCESS! Output saved to ", outputFile)
}