Main

All languages provide some way to execute code immediately.

Scripting languages such as Python and Ruby will execute all code in order immediately, whereas class-based languages such as C# and Java require a class wrapping a static method akin to C/C++'s "main" function.

Budgie resolves the differences by declaring an area as a "main context" with main context start and main context end. A main function may be declared within that context with main start and main end.

main context start
    main start
        print : ("Hello world!")
    main end
main context end

In C#:

using System;

class Program
{
    public static void Main()
    {
        Console.WriteLine("Hello world!");
    }
}

In Python:

if __name__ == "__main__":
    print("Hello world!")

Functions

Main contexts, other than the way they're declared, are functionally identically to standalone function groups. That means you can still declare standalone functions within them.

In C#:

In Python:

Function names must be given in PascalCase so that Budgie can transform them into the appropriate case for the output language. JavaScript, for example, prefers camelCase, while Python prefers snake_case.

Last updated

Was this helpful?