H20
H20 is the same as Java but better literally, no extra twists.
Good to know:privatemut to allow changesmain(), which is always publicinclude, but C++ functions are not allowedinclude, includeNext, define, ifdef,
endif, pragma, delete
free(), memalloc()
public, privateint, float, boolean,
String
class, func, mut,
use, new, if / else / elif,
for, return
print()Single file mode only:
--output-cpp - outputs the generated C++ file instead of compiling--output-assembly - outputs the generated assemblyH20.exe in your source folderHelloWorld.h20:
public class HelloWorld {
func main() {
printLn("Hello World!")
}
}
> ./h20.exe HelloWorld.h20
Note: Output flags are disabled in project mode
src.H20.exe in the root directorymain.txt containing your main class name: Main
src/:
src/HelloWorld.h20
public class HelloWorld {
func hi() {
for (mut int i = 1; i < 100; i++) {
print(i)
}
}
}
src/Main.h20
use HelloWorld
public class Main {
func main() {
HelloWorld hi = new HelloWorld()
hi.hi()
}
}
> ./h20.exe -project main.txt