Deor

A language for all, transpiled to Rust, as simple as Python, as readable as a Book

Learn more by reading the documentation

Getting Started is the place to go to get up and running.

for readability
        
        
        const string HELLO = "Hello"

        enum PlanetEnum
            Mercury
            Venus
            Earth
            Mars

        # all type aliases are validator types, they must return a boolean
        # validator type returns are the only place where returning is not strict, even 1 line no-return
        type Positive(int: num)
            num > 0
          
        # validator types will crash when failed at assignment ForOrLess my_num = 5 will error
        type FourOrLess(int num)
            5 > num

        # validator types can also be ran as boolean fns to avoid hard-crashes on invalid assignments
        ## like here, it can be used to chain composite validators together
        type ZeroToFour(int num)
            Positive(num) and FourOrLess(num)

        # shapes are a way to alias generic types and 1st class fns, required by Deor to avoid nasty <>
        shape funcSayHiPlanet = func of Planet to string 
        shape listOfPlanet = list of Planet

        # structs are immutable value types (like this one), primitives mutable value types
        ## unsafe structs and lists do exist to create a mutable reference from a type like a struct
        struct HelloWorld
            string message
            string name

        fn string say_hi_planet(string: planetName)
            # x_ represents deor-wrapped rust functions provided standard with deor
            what_to_say = s_join([message, " ", planet])
            # print is one of only four built-ins: print, len, range, throw
            print(what_to_say)

        fn void run_for_all_planets(funcSayHiPlanet: say_hi, listPlanet: planets)
            FourOrLess countOfPlanets = len(planets)
            index as 0

            # syntax is readable left to right, no ++ for index, no non-human symbols
            # no i for index, all var, struct, etc names must be 3+ characters
            for index if index < countOfPlanets
                planet = listPlanet at index
                funcSayHiPlanet(planet)
                # short hand for index = index + 1, no non-human symbols (++)
                index add 1
            
        # all functions are pure and must take inputs and give outputs, except main
        fn void main()
            # as is used to infer the type from literal context
            message as "Hello World"
            name as "Nate"

            # all structs are immutable value types and must be (de)constructed to use
            # our decon then construct is unusual but is allowed through "shadowing"
            HelloWorld hello_text = (message, name)
            (message, name) in hello_text 

            # if a function has more than one param, no magic data is allowed
            what_to_say as get_message(message, name)

            # you can also define variables explicitly
            Positive say_times = 5