39 lines
No EOL
673 B
Go
39 lines
No EOL
673 B
Go
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)
|
|
} |