You need to tell haxe the classpath and main Class. Haxe doesn’t really support “Single File” programs like your example (at least to my knowledge), so I’d recommend putting your file into a directory, usually called src. You should also rename your file to be PascalCase, as the File’s name defines the class name, and class names in haxe must be PascalCase. If you don’t want to use a src folder, that should work too. This build.hxml file should do the trick:
-cp . # Set the classpath to the current working directory
-main MyProg # Should use a File called MyProg.hx in the classpath
-hl out.hl # output to a file called out.hl
Note that you need to remove the comments I made for this to be a valid hxml file.
In case you wanna put your code into a directory src instead, you can set the classpath to src instead of . (the current working directory).
The same can also be achieved via these command line arguments