Getting startedSlide 1 of 85
1mainGetting started
Hello, World
Grammar: file, echo-stmt
file = { import | declaration } EOF ;As the compiler reads it; §2.1 of the specification is out of date here.
echo-stmtSpecification §2.5
echo-stmt = "echo" expression ;Every Hive program starts at proc main(): void, in the file handed to hive run or hive build. main takes nothing and answers with nothing, and any other signature is a compile error: the command line arrives through hive.term.args() and an exit status leaves through hive.term.exit(code), both of them met later on. A file with no main at all still compiles — it is a library, or a file of tests.
echo prints one value and a newline, turning whatever it is given into text the way the slide on echo describes. Inside a double-quoted string, {…} puts a value in — echo "{a} and {b}" prints both — and the slide on strings has the rest.
proc main(): void {
echo "it works"
}You can edit this program and run it here.Tab indents, Escape leaves the program, and Ctrl+Enter runs it.