11/25/2011

Booleans and boolean expressions

It is highly likely that you have noticed that boolean expressions are horribly supported in TBS alpha-2.9 and older. Luckily, alpha-3 may come to the rescue!
The following(pointless but interesting) program and its explanation, should provide you with an idea of how alpha-3 will handle boolean expressions.
using(Stdio);
#func() {
    ?blnTest =: 1 == 1 && 1 <> 2 && :<>false;
    _if(:false || 1>0 && :?blnTest) {
        !out(~"New, working expressions! Finally!\n");
    }
    : : :true;
};
!func();
_die();
The first thing you should know is that the boolean operator was changed from '|' to ':', I know, neither are "logical", but it's really hard to find a more logical character that a normal keyboard has.

Besides that, you must also know that the previous "=/" operator has been changed to "<>", the "=<" operator to "<=", the "=>" operator to ">=" and the previous "/" to "<>". The "&" operator is now "&&", just like the "|" was changed to "||". Notice however that "|" still exists, as the exclusive or(XOR).
I truly believe this is a good change as this notation is more widely used.

The return statement(": : :true;") might seem a little weird, but it is only logical: the first ':' represents the return command, the second one indicates that we will be returning a boolean expression, and the last one that we read a boolean value in that expression. For example, if we wanted to return a string we would write ":~?string;", or if we wanted to return a boolean as the result of a string comparison we would write  ": : ~"string" == ?string;".

11/18/2011

Graphical TBS

Thanks to SDL(Simple DirectMedia Layer), TBS alpha-3 will support some basic, 2 dimensional, graphics. I will make sure to link with the shared library instead of including the headers directly, simply because otherwise it would be illegal to use this library. I have created a very simple TBS program, which demonstrates how it works, the result of this program can be seen in the following video:


11/11/2011

Bugs with nested loops: fixed in alpha-3

Unfortunately, because of a bug in alpha-2.9 and earlier versions, nested subroutines did not work. I am happy to tell you that this bug has been fixed in version alpha-3.
I discovered this bug during a graphical test, yes, you read it: a graphical test. Indeed, graphical features will be added to TBS using the SDL(Simple DirectMedia Layer) library.

11/07/2011

Changes to system subroutines

Alpha-3 will, similar to PHP, include a huge number of system subroutines. But let's be honest: PHP has way too many functions in the main scope. To prevent this from happening to TBS, I have decided to add a new statement: the using statement. It is not a language construct, just a keyword. For example, the classic "Hello, world!" program will now have to be written like this:
using(Stdio);
!out(~"Hello, world!\n");
_die();
"Stdio" is the package that contains the standard I/O facilities. All package names will start with a capital.
Notice that it will not be possible to define these package names yourself, they are just a way of ordering the build-in language facilities.
Also notice that I have decided not to maintain backward compatibility with the old subroutine system, because I assume that nobody uses an alpha release for real-world systems. Besides that, I have also decided to maintain compatibility with windows for now. Windows binaries will most likely be compiled for alpha-3/4.

11/02/2011

alpha-2.9: release

To Be Simple alpha-2.9 has been released!
First, I would like to point out some things that will be improved/added in alpha-3(next release):
  • I will be completely changing the way system subroutines are called, allowing me to add more and more system subroutines. This will also increase the languages speed a lot. These subroutines will replace the current STDL, which will still exist but with other, more advanced features. All the subroutine names will remain the same, because of backward compatibility.
  • There are too possibilities, or I will drop windows and I will add multi threading and sockets, or I will leave TBS as it is now and compile a windows binary(this will be voted).
  • I will attempt to improve performance a lot.
Now, for alpha-2.9, you can either use the debian package and install it or, alternatively, if your distribution doesn't support that or that doesn't work(or you just want to do it "the hard way"), you can download the raw files and put them in /usr/bin/. Quick tutorial:

  1. Go to /usr/bin/ as root(sudo nautilus for ubuntu).
  2. Move the files tbs-STDL and tbs there.
Then I have another package ready, which contains some examples.

Too see what everything contains and were everything is, see my previous post.

alpha-2.9: ready for release

As you can see on the image above, the alpha-2.9 packages are ready for release. They contain:
  • An updated(and more readable) language summary.
  • A fixed version of the TBS STDL(which broke due to lack of backward compatibility).
  • The TBS interpreter(version alpa-2.9).
This time, I have also created another file, which contains some examples(most of them I use as a test).
  • stdl.tbs is a program which does a number of operations using the STDL(in fact, all currently possible things).
  • subj_sub.tbs demonstrates "wildcard" subroutines.
  • person.tbs is a pseudo-OOP example.
  • substitution.tbs shows you how code aliases work.
  • encrypt.tbs uses a character shift for "encrypting" text.
  • decrypt.tbs uses a character shift for "decrypting" text "encrypted" by encrypt.tbs.
  • words.tbs generates a random word "of the day" based upon the words in "words".
TBS alpha-2.9 will be released today or tomorrow!

In other news...
You may have noticed I have stopped posting quotes at the beginning of topics, this is because it's getting hard to find them.