Hello world !

Classic “Hello, World”

Main.tlang:

use io.Terminal

helper {

    func main() {
        Terminal.println("Hello, World !")
    }
}

manifest.yaml

1
2
3
4
5
6
7
8
name: HelloWorld
project: IntegrationTests
organisation: TLang
version: 1.0.0
stability: alpha
releaseNumber: 1
dependencies:
  - TLang/IO/Terminal 1.0.0:alpha:1 io

Generate “Hello, World” in Scala

Main.tlang:

use io.Terminal
use gen.Generator

helper {

    func main() {
        Terminal.println(Generator.generate(helloWorld()))
    }
}

lang[scala] helloWorld() {
    pkg hello_world

    impl HelloWorld {
        func main(args: String[]) {
            println("Hello, World!")
        }
    }
}

manifest.yaml

1
2
3
4
5
6
7
8
9
name: HelloWorldInScala
project: IntegrationTests
organisation: TLang
version: 1.0.0
stability: alpha
releaseNumber: 1
dependencies:
  - TLang/IO/Terminal 1.0.0:alpha:1 io
  - TLang/Generator/Generator 1.0.0:alpha:1 gen

To run this example, in your favourite terminal, go to the folder where you saved these files and then run:

1
tlang run .