Friday, October 14, 2011

USL 3.7.6

Several adjustments and additions in 3.7.6. Previously I added the ability to assign numeric values with encapsulated expressions. The limitation to numeric values was unattractive and so I allow assignment with string variables as well. The expressions may be used in conditional statements as well. Numeric assignments can contain these operators: +, -, *, /, ^, and %. String assignments can contain these operators: +, -, and *. I also added the "unless" statement to compliment the conditionals of USL. The unless-statement is exactly the same as an if-statement except for the fact that it only executes code if a statement is false. Drawing more inspiration from Ruby. I also moved all of the old time functions into the usl-specific environment variables list. You can still access the old time methods, but as environment variables. Remember, you can pull values from any environment variable as long as it exists. I also revamped a few older commands like "return" and "remove." The old remove command could only remove single objects from memory. With the aid of parentheses this command can remove multiple objects. The old return command could only return specific values (numeric, string, variable values, other method return values). With the aid of parentheses, the return command can return a more modified value instead of setting up the return value before returning. :P

New remove example:

       usl: 3.7.6

       Some people split their e-mail address in order to avoid 
       web crawlers from finding them.

       This script shows how to assemble email addresses
       from these split words with unorthodox scripting language.

method getEmail(s)
        @s = $0

        list words
        words = @s.split()

        for w in words
                @w = "${w}"

                 switch @w
                       case "dot"
                               @email += "."
                       case "dash"
                               @email += "-"
                       case "at"
                               @email += "@"
                               @email += @w

        remove (@s,@w,words)

        return @email

# @original = "chomp.enter split email: "

@original = "unorthodox dash scripting dash language at iconoclazt dot com"
@built = getEmail(@original)

say "\]Original:\[\{@original}\]E-mail address: \{@built}"

Random examples:
method foo
        @perishing = "This variable will be removed from memory."
        @perishing = "Hello, World!"

        return (@perishing*5)

@string = (@string+@string)
# is the same as
@string += @string

@num = 10

if @num < (@num+@num)
        say "Ten is less than twenty."

unless (@num^2) < 20
        say "Unless the expression is true, say this message."

I will update this blog post when I get around to it. Pardon the simplicity of these examples. I need SLEEP. I've updated the MediaWiki and you can find it under the "Hosted Apps" tab at the sourceforge link below.

To download 3.7.6, you can visit any of the following links:

No comments:

Post a Comment