Monday, November 21, 2011

USL 3.8.4

I have added curly-brace blocks for method, while, and switch. The end keyword is still available to those who dislike curly-braced code-blocks. I fixed the null value. Apparently null variables could be set as strings but not as numbers. This issue has been resolved. I have also fixed tons of issues in the Mac binary. Why is C++ in Linux not compatible with OS X? Both are POSIX and should compile with basically no auditing. Thankfully I only needed to fix a few lines in one file instead of every other line throughout the entire set. Here are some examples of the curly-brace blocks and a reintroduction to the null keyword.

Curly-Brace Code-Blocks:
method __
{
       @var = "Value"
       switch @var
       {
              case "value"
                     say "This will not be seen."
              case "Value"
                     say "Curly-Brace Example."
       }
}

__

Reintroduction to null in USL:

For those who did not already know, null removes the type and value of a variable. It allows a variable to change its "type."

Example:
@str = "a string."    # @str is now a string.
@str = 3.14159        # @str is still a string.
@str = null           # @str is no longer a string.
redefine @str @num    # changing the identifier of @str to @num.
@num = 3.14159        # @num is now a number.
@num = null           # @num is no longer a number.
@num = "a string."    # @num is now a string.
remove @num           # @num is no longer a variable.

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

Saturday, November 19, 2011

USL 3.8.3

I finally fixed the library loading issue brought to my attention in an email last week. USL now loads library definitions in script mode exactly as in shell mode. I changed the equal and unequal conditional operators as well. I'll demonstrate below.

New conditional statements:
if true == false
       say "This will never be seen."
orif true != false
       say "true is never false"
else
       say "This will never be seen."
endif

This may seem like a very small change, but the previous version would not load scripts correctly. This version will. Tested on Mac OS X, Linux, and Windows.

To download 3.8.3, you can visit any of the following links:
sourceforge
freecode

Friday, November 18, 2011

USL for Mac OS X

A few people were wondering where the Mac binary was. So I compiled 3.8.2 on Mac OS X 10.6.6.

The Sparc compliant binary will come soon. Probably with the next release. I plan on distributing Linux, Win32, Mac, and Sparc versions of USL from here on out. Once the Sparc box is working that is. Until then the distributable will contain Linux, Win32, and Mac binaries. Thank you to the Mac and Solaris users interested in my language.

Here is the binary: USL for Mac OS X

Tuesday, November 15, 2011

USL 3.8.2

After releasing 3.8.1, I forgot to check for bugs. Dev-FAIL on my part. I had fixed a very important issue in 3.8.1 but soon realized my interpreter was broken. This new release fixes those bugs. Thankfully. It took me three days to work out the best solution. Hope you are all happy with it. Sorry, Bruce. I will add your suggestion in the next release. I had that feeling you get when you finally fix the most irritating bug in your software. A eureka moment that I absolutely had to share with the end-users. So here it is.

In case you haven't figured out what the giant bug was, it was in the return keyword. When returning parentheses encapsulated expressions, the temporary parameter variables weren't being parsed correctly. So if you had a method returning (@var + 5), the method would have returned a string with the value: @var5. This issue has been resolved.

I have also added a way to capture parsed stdout similar to capturing the stdout of external processes.

Assigning variables with captured output:
@host = "chomp.Enter host: "
@pingResults ? "ping \{@host}"

@parsedOutput ! "for i in (1..15);say '${i}';endfor"
To download 3.8.2, you can visit any of the following links:
sourceforge
freecode

Wednesday, November 9, 2011

USL 3.8.1

A kind anon alerted me to a few bugs and I have resolved the issues. The problem with 3.8.0 was that object instantiations would not inherit private members. Now they inherit everything for they are instances. Inheritance still works the same way as before. Another problem with the previous versions was parentheses encapsulated expressions. Just a white-space issue. Some examples.

Parentheses example:
list words
words = ( "Anonymous", "is", "still", "able", "to", "deliver." )
The other change is self-explanatory. If an object member is private, it would not be inherited by object instances. Now all members will be inherited as the instance is merely a copy of the original object. Inheritance still works the same.
object Parent
       private
              method priv_m
                     say "I am a private method."
              end
       public
              method pub_m
                     say "I am a public method."
              end
end

object Child = Parent
end

p = Parent
c = Child

p.priv_m       # Success
c.priv_m       # Failure
To download 3.8.1, you can visit any of the following links:
sourceforge
freecode

Sparc compliant binary will be available within the next couple of weeks.

Wednesday, November 2, 2011

USL 3.8.0

Seven changes have been made in this release. The seventh being the most important. Allow me to explain each change individually.

1. Object instances are now implicitly removed when created in methods.
object o
       method m;say "Hello, World!";end
end

method m
       oo = o       # oo will be removed after leaving this method
       oo.m
end

2. Object variables may now be public or private members.
object o
       public
              @var = "Hello, World!"

              method m
                     say self.@var
              end
end

oo = o
oo.m

3. Errors return the actual line where the error occurred. (It returns the actual code that threw the error.)

4. Fixed the bug in say when printing the value of just an object variable. (Refer to example 2.)

5. Fixed the self keyword. self used to be limited to only executing object methods and returning their values with interpolation.

6. Interpreter and script arguments are now retrieved with indices.
first_arg = args[0]

7. USL now implicitly creates temporary variables from method parameters.
method generic_add(a,b)
       return (@a+@b)
end

@str = generic_add("abc","def")
@num = generic_add(250,6)
To download 3.8.0, you can visit any of the following links:
sourceforge
freecode

Saturday, October 29, 2011

USh

I have created a shell with USL as the native scripting language. I call it "Unorthodox Shell" or "USh" for short. You would pronounce that: uh-SH; oo-SH

:P

I also fixed the ~ error for Linux operating systems. Previously, the interpreter didn't parse the ~ character correctly. I actually found that bug accidentally. So there's a fix for the Linux users. The Windows users have no issue with the the ~ character.

I'm still working on anonymous functions.

For the people wanting generic methods, I have uploaded a picture for you.


Saturday, October 22, 2011

USL 3.7.9

This release touches up on interpolation. You may now retrieve values from list indices, list ranges, variable indices, variable ranges, and methods to be used in quoted strings. Which means you can print values easier and be more specific with what values are assigned. This release also fixes the chomp and shomp keywords which would originally not format the escape sequences of output strings when retrieving input. It also changes the escape characters from "\]" and "\[" to "\n" and "\t", respectively. Now you may retrieve input in a more formatted manner. This release also allows variables to be used as parameters to the "random" method.

Here are some examples:
@string = "abcdef"

object obj
       method foo(bar)
              return $0
       end

       method bar
              return "Hello, World!"
       end
end

method foo(bar)
       return $0
end

method bar
       return "Hello, World!"
end

list array

array = ("abc","def","ghi")

for i in (0..2)
       say "\{array[${i}]}"
endfor

for i in (2..0)
       say "\{array[${i}]}"
endfor

say "\{@string[5..0]}"
say "\{@string[0..5]}"
say "\{obj.foo(@string)}"
say "\{obj.bar}"
say "\{foo(@string)}"
say "\{bar}"
say "\{array[0..2]}"
say "\{array[2..0]}"

method get_randoms(a,b,c,d)
       @a = $0;@b = $1
       @c = $2;@d = $3

       list rands

       for i in (@a..@b)
              @r = random(@c..@d)

              rands += @r
       endfor

       return rands
end

list randoms

randoms = get_randoms(1,10,a,z)

To download 3.7.9, you can visit any of the following links:
sourceforge
freecode

Friday, October 21, 2011

USL 3.7.8

I have added a lot of different features in 3.7.8 thanks to suggestions. I have added list slicing from Python, variable indices, variable ranges, list indices, list ranges, sub-strings, and so forth.
I have also changed the way methods execute their code. Methods may now return a list object instead of just variables, strings, and numeric values. Any variables or lists created within the method are implicitly removed after leaving the method.

Here is an example of list slicing:
list list_a
list list_b

list_a = ("abc","bcd","cde","def")

list_b = list_a[0..3]       # list_b contains all elements of list_a
list_b = list_a[3..0]       # list_b contains all elements of list_a, reversed
Here is an example of iterating a sub-string:
@string "Hello, World!"

# loop a substring
for c in @string[0..12]
       say ${c}
endfor

# reversed
for c in @string[12..0]
       say ${c}
endfor
Here is an example of retrieving a sub-string:
@string = "Hello, World!"

@sub_str = @string[0..12]
@reversed = @string[12..0]
Here is an example of the new methods:
method get_even_numbers
       list even_numbers

       for x in (0..15)
              if (${x}%2) == 0
                     even_numbers += ${x}
              endif
       endfor

       return even_numbers
end

list numbers
numbers = get_even_numbers

To download 3.7.8, you can visit any of the following links:
sourceforge
freecode

Tuesday, October 18, 2011

USL 3.7.7

This release changes the old random function, fixes the return bug, and adds empty_string & empty_number as USL-specific environment variables. The old random function was very awkward but the new random function conforms to the recently introduced ranges of USL. I have also written a usl-doc for all of those people saying things like: "Is there ANY documentation on this AT ALL?!?!"

I'm 21 years old and am writing my own computer language. I took the time of day to write you some documentation.

P.S. THANK YOU to the people from 43 different countries that have downloaded my language. It is so much better than a paycheck or a salary. I wish I could personally thank each of you for considering the language. I hope to make it as useful as possible with what time I have and hope you enjoy using it. Whether you are writing attack scripts or simple every day task scripts. Just enjoy the language. I made it for you.

If you have any questions/comments/suggestions, send me an e-mail at scstauf@gmail.com. I don't mind if you write in your own language. I will use Google Translate.

Back to the programming.

Here is an example of the new random function:
method gen_rand
       @random = env.empty_string

       for i in (1..256)
              @c = random(a..z)

              @random += @c
       endfor

       remove @c
       return @random
end

@rand_str = gen_rand

say "Random String: \{@rand_str}"
Here is an object-oriented guessing game:
##
guessing_game.us

run with: usl -n guessing_game.us
##

object AI
       public
              method init
                     @&__AI_num = env.empty_number
              end

              method set(num)
                     self.init
                     @&__AI_num = $0
              end

              method genRand
                     @random = random(1..5)

                     return @random
              end

              method makeChoice
                     self.set(self.genRand)
              end

              method getChoice
                     return @&__AI_num
              end
end

method getChoice
       @c = "chomp.Your choice: "

       return @c
end

method reset
       delay 2

       ? @clearScreen
end

method setup
       @choice = env.empty_number
       @os = env.os

       if @os = "UNIXMacorLinux"
              @clearScreen = "clear"
       else
              @clearScreen = "cls"
       endif

       ai = AI

       game
end

method game
       for infinity
              say "Pick a number between 1 and 5...0 to exit\]"
              say "The computer is making its choice...\]"
              ai.makeChoice

              try
                     @choice = getChoice
              catch
                     say "\]Leaving!"
                     leave!
              caught

              switch @choice
                     case 0
                            say "\]Leaving!"
                            leave!
                     default
                            @aiChoice = ai.getChoice

                            if @choice = @aiChoice
                                   say "\]You guessed correctly!"

                                   reset
                            else
                                   say "\]You guessed incorrectly!"
                                   say "\]Your choice:\[\{@choice}"
                                   say "AI choice:\[\{@aiChoice}\]"

                                   reset
                            endif
              end
       endfor
end

say "A Simple Guessing Game\]"
              
setup

# EOF

I've updated the MediaWiki and you can find it under the "Hosted Apps" tab at the sourceforge link below.

To download 3.7.7, you can visit any of the following links:
sourceforge
freecode

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:

##
       file: email.us
       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 += "@"
                       default
                               @email += @w
                end
        endfor

        remove (@s,@w,words)

        return @email
end

# @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)
end

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

@num = 10

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

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

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:
sourceforge
freecode

Wednesday, October 12, 2011

USL 3.7.5

I have changed the way variables are created so the binary size has been decreased but not too dramatically (~.04MB). I have also added various features to list objects to make them more usable. I also fixed the comments. Previously, comments on the same line would nullify the statement(s) before them. This version allows comments on the same line. The list now has indexes. These indexes can be used to set variable values and vice versa. Lists may also be populated in a new way. I will demonstrate below.

New list demonstration:

##
       animal_list.us

       to execute: usl animal_list.us

       or just type as you see it in the USL shell
##

@animal = "tiger"
list animals

animals = ("elephant",@animal,"chameleon") 
# animals contains: elephant, tiger, chameleon

@animal = animals[0]    # @animal contains: elephant

try
       animals[0] = "shark"
       animals[1] = "whale"
       animals[2] = "dolphin"
       animals[3] = "This will throw an index out of bounds exception."
catch
       say "The index value exceeded the list size."
caught

see animals     # animals contains: shark, whale, dolphin

# eof

I've updated the MediaWiki and you can find it under the "Hosted Apps" tab at the sourceforge link below.

To download 3.7.5, you can visit any of the following links:
sourceforge
freecode

Sunday, October 2, 2011

USL 3.7.4

I have received a few suggestions in my quest. So in reply, I have audited my code to produce the desired suggestions. ;]

The white-space convention of the previous versions was far too strict, so I have changed the convention dramatically.

Example:
object    o
       method         m
              say      "Hello, World!"
       end
end

o.m
say "There is white-space after the last quotation mark!"        

The above code would not be parsed correctly in the previous versions. The new release is more lenient with white-space.

The first suggestion I received was another for-loop. A for-loop that would return an iterable list or a range of numbers. So I developed both.

New for-loops:
# iterable list loops

@file = "example.txt"
list lines
for line in @file.read
       lines += "${line}"
endfor

@line_num = 1

for line in lines
       say "Line(\{@line_num}): ${line}"
       @line_num += 1
endfor

# range loops

for i in (1..25)
       say "Iteration: ${i}"
endfor

for i in (25..-25)
       if "${i}" < 0
              say "${i} is negative."
       orif "${i}" = 0
              say "${i} is zero."
       else
              say "${i} is positive."
       endif
endfor
The second suggestion I received was to add an "fwrite" command. The "fwrite" command would cut the use of creating a file with the "fpush" command and appending text with the "append" or "appendl" commands.

My "fwrite" creates a file if it does not already exist and then appends text to it.

The "fwrite" command returns: "1" if the file was created, "0" if the file already existed, or "-1" if an error occurred. The error is caused by using a numeric variable or value instead of a string variable or string literal as the file parameter of the "fwrite" command.

Catching the return value of "fwrite":
method fwrite(file,contents)
       fwrite $0 $1
end

@contents = "This text will be appended to a file with the fwrite command."

@ret_val = fwrite("file.txt",@contents)

switch @ret_val
       case 0
              say "Content has been appended."
       case 1
              say "File was created."
              say "Content has been appended."
       case -1
              error "An error occurred."
       default
              say "Another value was returned instead."
              say "This will happen if the fwrite operation is not at the end of the method."
end
The third suggestion I received was sort of a self-conceived suggestion to change the code-separator symbol from a pipe-symbol to the more traditional semi-colon. This at first caused problems with methods and objects, but I fixed it and now the language runs smooth with the "end" keyword to end method, object, template, and thread definitions.

Here is an example demonstrating most of what I have just mentioned:
object obj
       public
              method __m(s)
                     @__s = $0

                     switch @__s
                            case "hello"
                                   self.sayHello
                            case "bye"
                                   self.sayGoodbye
                            case "while"
                                   @commands = "say 'in a little while'"
                                   self.++while(@commands,0,10)
                                   remove @commands
                            default
                                   say "Invalid Case: \{@__s}"
                     end
              end

              method sayHello
                     say "Hello, World!"
              end

              method sayGoodbye
                     say "Goodbye, World!"
              end

              method ++while(commands,start,stop)
                     @cmd = $0;@start = $1;@stop = $2

                     while @start < @stop
                            ! @cmd
                            @start += 1
                     end

                     remove @cmd;remove @start;remove @stop
              end
end
The final suggestion I received was to replace the list populating function of variables with a "split" function.

Previously, a list could be populated as so:
list array
@s = "abcdefghijklmnopqrstuvwxyz0123456789"
array = @s.size
# array contains 36 items
This causes much confusion to some people, so I will replace "size" with "get_chars" in the future. I have added the "split" function for populating lists in place of the "size" function.

String split example:
@s = "This is a string with multiple instances of the letter \'i\'."
list eye_split

eye_split = @s.split("i")

##
       eye_split now contains: 
              Th
              s
              s a str
              ng w
              th mult
              ple
              nstances of the letter '
              '.
##

eye_split = @s.split()

##
       eye_split now contains: 
              This
              is
              a
              string
              with
              multiple
              instances
              of
              the
              letter
              'i'.
##

eye_split.reverse

##
       eye_split now contains: 
              'i'.
              letter
              the
              of
              instances
              multiple
              with
              string
              a
              is
              This
##

# revert to previous content
eye_split.revert

eye_split.sort

##
       eye_split now contains: 
              'i'.
              This
              a
              instances
              is
              letter
              multiple
              of
              string
              the
              with
##

# empty all content
eye_split.clear
I've updated the MediaWiki and you can find it under the "Hosted Apps" tab at the sourceforge link below.

To download 3.7.4, you can visit any of the following links:
sourceforge
freecode

Saturday, October 1, 2011

USL 3.7.3

I realized that separate mathematical operations weren't very attractive, so I have added another way to assign numeric variables.  I also added a modulo assignment operator.  I can't believe I forgot that before.

Anyway...here are a few examples. :]

New ways to assign numeric values to the untyped variables of USL:
method getYear
       @year = this_year
       return @year
end

method julian_leap?
       @julian_leap? = (getYear%4)
       @ret_val = false

       if @julian_leap? = 0
              @ret_val = true
       endif

       remove @julian_leap?
       return @ret_val
end

@is_leap? = julian_leap?

say "Is this year a Julian leap year: \{@is_leap?}"

@pi = 3.14
@r = 256
@c_sphere = (2*@pi*@r)
@half_of_c = "(@c_sphere / 2)"

say "Circumference of a sphere with a radius of \{@r}: \{@c_sphere}\]Half of the circumference: \{@half_of_c}"

@r %= 4

if @r = 0
       say "The radius is divisible by four."
else
       say "This will never be seen."
endif

clear_all!

say "All objects have been removed from memory.\]Leaving in 5 seconds..."
delay 5
exit


I've updated the MediaWiki and you can find it under the "Hosted Apps" tab at the sourceforge link below.

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

sourceforge
freecode

Friday, September 30, 2011

USL 3.7.2

I was writing some libraries for my language and realized I was missing out on certain features.  I have added the ability to compare method return values in if-expressions.  Very useful.  I also added the ability to define my own iterators.  Previously iterators have only been the '$' character.  Now iterator symbols may be defined explicitly.  I also fixed the way string literals are parsed.  So you can retrieve variable values inside of quotation marks during certain operations.  It's very useful.  Here are some examples.

Iterators example:
list array

for 1 < 10 (i)
        array += "Element(${i})"
endfor

loop array (item)
        say "Item: ${item}"
endfor

Comparing methods:
object o
        method m(a)
                return $0
        end
end

method m(a)
        return $0
end

if m("foobar") = o.m("foobar")
        say "These methods return the same values."
        say "You can compare return values to variable values as well."
else
        say "This will never be seen."
endif

New string literal parsing system:
method get_host_address(host)
        @host = $0
        @ping ? "ping -n 1 \{@host}"

        @ip = " ";@ip -= @ip
        @start = false

        loop @ping.size (char)
                if @start = true
                        @ip += "${char}"
                endif

                if "${char}" = "["
                        @start = true
                orif "${char}" = "]"
                        @start = false
                endif
        endfor

        @ip -= "]"

        remove @ping
        remove @start
        remove @host

        return @ip
end

@hostname = "chomp.enter host name: "
@address = get_host_address(@hostname)

say "address: \{@address}"

clear_all!

I've updated the MediaWiki and you can find it under the "Hosted Apps" tab at the sourceforge link below.

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

sourceforge
freecode

Sunday, September 25, 2011

USL 3.7.1

In this release I added while loops, constants, switch statements, and exponential operators. I also updated the comprehensive help function.

The while loops are the only loops that can contain nested for loops at the moment. I have to fix nesting for loops but I work around that with while loops now.  While loops expressions must begin with a numeric variable to toggle.  I haven't programmed strings for while loop expressions yet but that will come soon (probably tomorrow).

Here is an example:
@a = 1
@b = 10
while @a <= @b
        for 5 > 1
                out "${$} "
        endfor
        @a += 1
end

The switch statements require a variable to be switched against. The variable may be either string or number and the cases may be both string or number. If no cases match, a default block of code will be parsed.

Here is an example:
method example
        @c = "This is a string."

        switch @c
                case "This is a string"
                        say "Not quite..."
                        say "The next case will be evaluated."
                case 3.14159
                        say "That is pi..."
                case "This is a string."
                        say "A match was found!"
                default
                        say "No match was found..."
        end
end

example

Constant values are immutable, meaning you cannot alter them. Constant identifiers may only contain characters A through Z and underscores. Constant variables are only used to assign values to variables.

Here is an example:
MY_CONST = "This value is immutable."
@c = MY_CONST 
say @c

The exponential operator **= assigns a numeric variable to the power of a given operand.

Here is an example:
@d = 25.6
@d **= 2

say @d

I've updated the MediaWiki and you can find it under the "Hosted Apps" tab at the sourceforge link below.

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

sourceforge
freecode

Saturday, September 24, 2011

USL 3.7.0

I added exception-handling with the "try-catch-caught" keywords.  Believe it or not, it took me awhile to do this and I had ran into many complications until tonight when I found all I had to do was structure my code differently to utilize the benefits of try-catch-caught.  At first only an error in the try block would work correctly.  Now both erroneous and impeccable code works.  The original error message is contained in a keyword called "last_error" which may be assigned to a variable.  The variable is disposed after "caught" is called.  This is an extra garbage-handling feature I added.

The way my try statements work are as follows:

1. Try to parse code until "catch" keyword.
2. If an error occurs before "catch", stop parsing and skip to catch code.
3. If an error does not occur, skip catch code.
4. Parse until caught.

An example would be:
method test
        try
                @var = 123.456789
                @var = "This will cause a conversion error."
                say "This will never be seen as an error already occurred."
        catch
                @e = last_error
                say "An error occurred: ${@e}"
        caught

        say "try-catch-caught may be used as many times as necessary."
end

test
Produces: An error occurred: conversion_error:@a

If an error does not occur, the catch code will not be parsed.  If an error does occur, parsing stops and USL automatically starts parsing the catch code until all is caught.  The caught keyword closes the try statement.  You may use try-catch-caught as many times as is needed.  Other languages exit the method/function after try-catch statements.  So that is another unique feature of USL that distinguishes it among other languages.

I've updated the MediaWiki and you can find it under the "Hosted Apps" tab at the sourceforge link below.

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

sourceforge
freecode

Sunday, September 18, 2011

USL 3.6.8

Aside from completely upgrading my code, I have added many new features to USL.
I have added these mathematical functions: abs, floor, ceil, cos, cosh, acos, tan, tanh, atan, sin, sinh, asin, log, sqrt, exp.

*note: I am occasionally using the ';' code separator so I can write code in single lines.

Example:
@a = 256
@b = @a.tan
say @b
Produces: 25.1116

I have also added some string control: to_lower, to_upper, is_lower?, is_upper?.

Example:
# swap case
@a = "This is a string."
@b = " ";@b -= " "

loop @a.size
       @c = "${$}"

       if @c = is_upper?
              @d = @c.to_lower
              @b += @d
       orif @c = is_lower?
              @d = @c.to_upper
              @b += @d
       else
              @b += @c
       endif
endfor

say @b
# end of example
Produces:  tHIS IS A STRING.

A new and interesting feature is the ability to load stubs of definitions. USL has always had a "load" command to load definitions from a script. The new version of USL allows separation of library definitions similar to namespaces and packages in C++ and Java, respectively.

Example:
##
lib_example.us
-------------------------
stubs in library script
##
[stub_a]
method say_hello
        say "Hello, World!"
end
[/stub_a]

[stub_b]
method say_hello
        say "Hello, Internet!"
end
[/stub_b]
# end of lib_example.us

##
lib_load.us
##
load lib_example.us
load stub_a

say_hello
remove say_hello
load stub_b
say_hello
# end of lib_load.us
Produces:
        Hello, World!
        Hello, Internet!

Sunday, August 28, 2011

USL 3.6.5

Before this release I had a lot of complaints and constructive-criticism from rohitab members. I fixed the code to be much more intuitive and easier to understand. I also added threading functionality and the ability to assign a string variable with the stdout of an application.

I completely changed these keywords: methdef, objdef, listdef, methend, objend

I replaced them with: method, object, list, ;;

To see examples of the new code and keywords in general visit the wiki.

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

sourceforge
freecode

Sunday, August 14, 2011

USL 3.6.3

In this release I have added the ability to assign public and private members to objects.  Previously all members of an object were passed on via inheritance.  Now you can be specific with what is inherited.

I have also added the ability to break loop flow.  This is a feature that I have been working on for awhile.

Here is an example of breaking the loop flow with the "leave!" command:
for 1 < 15
        @a += "${$}, "
        if "${$}" == 5
                leave!
        endif
endfor

say @a                   # 1, 2, 3, 4, 5, 

The public and private keywords are used similarly as in C++ but without the colon. Just as in C++, they can be used as many times as you need and wherever you need.

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

sourceforge
freecode

Introduction to USL++

Unorthodox Scripting Language is a light-weight, high-level, and object-oriented scripting language.  USL is written with C++ and compiled on both Linux and Win32 operating systems.  There is no socket capabilities in USL, but I will implement that in the near future.  USL was written in a few months, so don't expect it to be exactly perfect.  However, USL is quite powerful for such a small programming language and practical as a general purpose scripting language on a local system.

Regardless of whether or not you are a hacker or an everyday programmer, you will find the ability to quickly write fully functional applications (with an interpreter only consuming 1153kb of your hard-drive) quite handy.  It is completely portable, you can place the executable on a flash-drive and use it wherever you may need.

When a script is not supplied, USL becomes a fully programmable and customizable command-line shell.  You may store variable definitions for future use and remove them when they are no longer needed.  All commands of the underlying shell are fully accessible, ensuring the applicability of USL as a scripting language.

To see code examples, you can visit the wiki.

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

freshmeat
sourceforge

Please send any suggestions or comments to: scstauf@gmail.com

I check my e-mail frequently and will be able to respond quickly.

I will post release information as I continue to perfect USL on this blog and at freshmeat.

Thank you and happy hacking!