Hello, World! - LieutenantTeaTM/BubbleTea GitHub Wiki

When you have your executable ready, here is the basics on the BubbleTea language:

All BubbleTea programs start in a main() function. main() has several rules

  • You cannot have any arguments
  • You cannot call main()
  • main() must return null

Function syntax is as follows: fn IDENTIFIER (args) -> RETURN TYPE {}

The arrow -> is called the input operator. It plays a crucial role in the syntax.

To get an entry point started you can define it as:

fn main() -> null {
    // To-do
}

This will compile, but won't exactly do much if you run the executable. Let's change that!

We will use the macro p! which is BubbleTea's println!. There are different variations of print, but this is the most common. For now, we will use p!

fn main() -> null {
    p!("Hello, World!");
}

Great! Let's run it. You can transpile this code to Rust using the executable you built. The default name should be bubbletea. On your OS's terminal, in the directory of the executable, enter the command:

./bubbletea hello.tea

Replace hello.tea with whatever you named your file.

If all is successful, the BubbleTea parser will return:

BubbleTea brewed successfully! Transpiling to Rust!


Binary was output as hello

hello will be replaced with the file name. Run it as any other executable on your OS

./hello

Hello, World!

Success!