12/29/2011

An esoteric language

As I have posted earlier, I was planning to create a new programming language. Since then, I have written a simple interpreter. The idea is not to create a functional language, but just an esoteric language. A language to prove a point, not to solve a problem.
The following is an example of a program written in this language:

Create a variable named name. Display "Enter your name: " and a newline.
Vary the value of name by call the function "ask". Make another variable called age.
Display "Enter your age: " and a newline.
Set the value of age to call function "to number" with call another function "ask".
Display "The name is " and the name. Show "." plus a newline. Show "The age is ".
Display the age. Show "." and another newline.
If the name equals "World" then:
Display "Hello World!" and a newline.
Display another newline.
That's all. Else, then:
Display "Now this is no longer a 'Hello, world!' program..." and a newline. That's all.
If the age is larger than 100 or the age equals 100 then:
Display "You are very old." and a newline.
Display another newline. That's all.
Otherwise, then:
Display "You are less than 100 years old." and a newline. That's it. Show "Bye!" and a newline.
Stop the program.
As you can see, some statements(statements are sentences) or expressions may seem a little weird and not exactly like you would say or write it yourself. This is because it is simply too hard (for me at least) to write a parser that can understand the complete English language.
Vary the value of name by call the function "ask".
The above probably seems very weird. But in fact, "by" is declared as a synonym for "to"(which is required for changing the values of variables) and "call the function "ask"" is considered a part of an expression.
The following...
Set the value of age to call function "to number" with call another function "ask".
...is probably the weirdest statement of all. This is because it uses no temporary variables. It could be rewritten as following:
Declare a new variable named temp. Set the value of temp call function "get input". Change the value of age to execute procedure "to number" on temp.
I think the above is a more "natural", but it is also longer.
Also note that the last statement("Stop the program.") is actually only executed until "Stop" and no dot is actually required after it. "the program." will be tokenized by the parser to(displayed on a stack of tokens here):
-token::Article("the")
-token::VarName("program")
-token::Dot('.')
But these tokens will never reach the interpreter, and thus cannot cause errors(most likely "unexpected token" errors). This all means that we could also write:

Stop the current program and do something else.
So, what have I done so far and what are the parameters of the language?
I have added expressions, variables, "if" and "else" statements, an output language construct and function calls(no user defined functions, only system functions). I have also added a "newline" variable and 2 system functions("to number" and "ask"/"get input"). I am not yet sure when and if I will add features such as user-defined functions, but I will most likely add at least one type of loop(probably while).
Some specific things for this programming language are the huge amount of synonyms available for every word, the fact that if statements have no separate scope and the ability to "formulate" sentences in a different way(made possible by "optional" words such as "the value"). Because of these things, I hope it seems clear that this language has no intention of being functional in any way.

This interpreter will be available soon, although I cannot and will therefor not give you a date yet.

12/22/2011

Merry Christmas!

// Christmas, by Test(http://tbslanguage.blogspot.com/)
// Do not redistribute...
#include <iostream>
#define I std::cout
#define Jesus "Christ"
typedef std::string _;typedef int _____;typedef char& _O_O;
void                                                   oO(
char                         O                         ){//
I <<                        O;}                        void
oO(_                       O) {I                       <<O;}
class                     O {/**/                      /***/
/***/                    protected                     :char
o/**/                   ;public:///                    /////
virtual                char operator                   ()(){
return                '\n';}};struct o                 /**/:
public               O{o(char o){O::o=o                /***/
;}char              operator()(){ return               O::o;
}};                char __(_____ ___) {_               ____=
"moda"            "grippa@live.be";return              ____[
___];}           char _o_( _____ ___ ) { _             ____=
"You "          "will be assimilated. Resi"            "sta"
"nce "         "is futile.";return ____[___]           ;}///
/****/        template<class __> __ ___(__ o,          __ O)
/***/{       return o==O?(true?o:0):o+O;} void         OoO (
/****/      _O_O OoO,short O,bool _0=false){for        (////
short      o;o<O;++O){if(!_0)OoO++;else OoO--;}}       _____
_O_ (     _____ O);void oOo(){char _o=__(_O_(_O_(      ___(1+
true,    true+1)+(1+1 )*true ) ) + _O_ ( _O_ (___(     true +
true,   0)+1)));o _O(_o);char _0=_o;OoO(_0,(1+1) *(    1+1)*(
1+1+1) *(1+1));oO(_0);oO(_o);oO(_o+9+!false+_O_(1+1)); oO(_o+
_O_(                   ___(_O_(___                    (1+1 ,
_O_(                   1+1))),1+1+                    1)+1))
;oO(                   _o_(false)+                    2*(_O_
(_O_                   ('y'/(___ (                    _O_  (
_O_(                   _O_(1 ) )),                    _O_(-~
true)                  )+1)) ) )-~                    true );
oO  (                  _o_(-(~true                    -1))) ;
oO  (                  Jesus);oO (                    __(0));
oO(_o_((1+1)*(_O_(1)+_O_(true + 1))));oO(_o_(5*(1+1)+-(~true+~
true)));OoO(_0, _O_(_O_(_O_(_O_(_O_(1)))))+_O_(_O_(_O_(_O_(_O_
(1)))))+_O_(_O_(_O_(_O_(_O_(1)))))+_O_(_O_(_O_(_O_(_O_(1))))))
;oO(_0);oO('\n');}_____ _O_(_____ O){_____ o(O);if(o%2==0) o
   +=1;else o+=2;return o;}int main( ) {oOo() ; return 0 ;}
                /* Created by Test on 22/12/2012 */

12/17/2011

A new language

Since it is sometimes annoying to do just one thing at a time, I am currently searching for new and original ideas to implement in a simple (interpreted) programming language. So, if you have an idea then make sure to  email(modagrippa(at)live(dot)be) me.
Notice that this certainly does not mean that TBS will no longer be developed.

I will be posting more updates on this new language concept in the following days.

12/16/2011

SDL Support: delay

I'm currently having some problems(both technical and political) with SDL and I believe it is not likely that they will soon be fixed. Thus, the next release will most likely not yet contain support for SDL.

Currently, I'm still looking for another graphics library that might be integrated into TBS.

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.

10/29/2011

Words in TBS

An image of the words used in the entire TBS source code.


Just for fun, I generated this image of the TBS source code with Wordle today. I find it quit interesting that I use the word "value" the most. The Tokent.kind is something that I actually never use, I believe it should be 2 words: "Token" and "t.kind".
After that I decided to create another one, but this time of my blog posts:
An image of the words used in the posts of this blog.

As I expected, the most used word was TBS.

10/28/2011

Variable access changes


To improve is to change; to be perfect is to change often.
Winston Churchill

Alpha-2.9 was supposed to be released this weak, however I have decided to change a little thing about the way you can access variables. Instead of only using '?' for declarations, the question mark will now be used in front of all variables, similar to the PHP syntax.
For example, the following:
?greeting =~ "Hello!";
!out(~greeting, ~"\n");

Will now be written as:
?greeting =~ "Hello!";
!out(~?greeting, ~"\n");
I am aware of the fact that this is a big change that will affect almost all TBS code, although there should be no problem with this as alpha versions do not guarantee backwards compatibility.

10/17/2011

alpha-2.9

O earth, what changes hast thou seen!
Alfred Lord Tennyso
Because of the huge amount of changes for alpha-3, I have decided to release another version between 2 and 3 which will have all language features but will however not include the new STDL.

I know that I have not been posting for a while but that does not mean I haven’t worked on TBS. I shall release this subversion in this or in the next week.

10/02/2011

Help testing TBS

You can have everything in life you want, if you will just help other people get what they want.
Zig Ziglar

You might be interesting in testing TBS alpha-3 or to help me finding bugs. If you are please send me an email. If you found one or more bugs you will be given credit for finding bugs when I release the next version(currently alpha-3). So please, do not hesitate and help testing!

9/27/2011

alpha-3: casting to string

But quality of work can be expected only through personal satisfaction, dedication and enjoyment. In our profession, precision and perfection are not a dispensible luxury, but a simple necessity.
-Niklaus Wirth
 
You may know that in alpha-1 and 2 you can use the str subroutine to cast from an integer to a string. For example:
?number =~ "PI = ";
number = 3,141592654;
!out(~number, ~!str(number));
Output:
PI = 3,141592654
In alpha-3 str also accepts a 3th, optional argument. Notice that the above example would produce the following output in alpha-3:
PI = 3

This 3th argument is the decimal precision, and it's default value is 0. The following:

?number =~ "PI = ";
number = 3,141592654;
!out(~number, ~!str(number, 10));
 Will thus produce:
PI = 3,1415926540

9/25/2011

15 reasons why I prefer gedit

IDE features are language smells.
-Reg Braithwaite

I do not use any IDE, I just use gedit. Simply because gedit offers me what an IDE offers me. In this post, I'll be telling you 15 reasons why I prefer gedit above an IDE or another text editor.

9/19/2011

The current state on alpha-3

And, you know, the fact is, if you believe in evolution, we all have a common ancestor, and we all have a common ancestry with the plant in the lobby. This is what evolution tells us. And, it's true. It's kind of unbelievable.
Jeff Hawkins

This is just a short update on alpha-3, to show that I'm still working on TBS(I didn't post much because of that, in fact).
The last days I have been reorganizing the structure of TBS. I have, and probably will still, encountered some bugs but luckily I succeeded in fixing all of them. This means that I can now continue with restructuring the code. I also added the ability to provide less arguments than needed(see last post) and I added the first feature of the environment subroutine: OS checking.

9/14/2011

alpha-3: new features

I do not fear computers. I fear the lack of them.
Isaac Asimov
  
Obviously, alpha-3 will offer some new and interesting features. The goal of this post is the list the features that I currently have implemented or am planning to implement.

9/11/2011

C/C++: Creating an alternative syntax

If you can't explain it simply, you don't understand it well enough.
Albert Einstein

Today, for the first time, I will be posting about something not related to TBS. I'll be showing you how to use macros in C or C++ to create an alternative syntax. This can be fun if you like inventing new syntaxes but you don't want to write a complex compiler or interpreter.

9/10/2011

pseudo objects in alpha-3

Object-oriented programming is an exceptionally bad idea which could only have originated in California.
Edsger Dijkstra

Today, I realized that some of the new features that alpha-3 offers I would be able to create some sort of objects. Note that I did not intentionally add any support for OOP. I like to call this sort of objects pseudo objects and the classes that define them pseudo classes. Why? Because you can't really call them real objects.

9/09/2011

Tutorial 1: Hello, world!

Everything should be as simple as it is, but not simpler.
Albert Einstein


In this first tutorial I will be showing you how to write a simple Hello, world! program. You probably won't find this hard, certainly if you already now another programming language.

9/07/2011

alpha-2: release + tutorials

A person who never made a mistake never tried anything new.

-Albert Einstein


Two things this time: the alpha-2 release and a new page!

9/05/2011

Graphical possibilities?

"The days when you needed amazing Silicon Graphics machines to run animation software are gone now."
-Dave Rowntree

 The aim of TBS is not to draw nice windows on your monitor, yet I might add graphics possibilities. I would start by adding the ability to show simple message and input boxes in alpha-3 and later I would start by adding the ability to draw more complex windows with menus buttons, shapes and possibly images. Please note that this isn't certain at all.
In other news: you can expect alpha-2 to be released this week.

9/03/2011

Adding system commands

Change brings opportunity.
-Nido Qubein

Yesterday, I received an interesting question from rambler on this blog. He asked if TBS supports system calls. I had to answer no, because I forgot to add them...

9/02/2011

Problems with alpha-1

"Errare humanum est."
-Some Roman

It seems that there is a problem for some people with the Debian package that should install TBS. For those people, I would propose the following(very simple) alternative solution:
First of all, download this file.
Then go to /usr/bin/ as root(sudo nautilus for ubuntu).
And finally, simply move the files tbs-STDL and tbs to there.
You should be able to use tbs normally now.

TBS alpha-2: errors?

Ominium rerum principia parva sunt.
 -Marcus Tullius Cicero

In the next version of TBS, error reporting will be improved. In addition to that, you will also be able to disable all error reporting.

9/01/2011

Hello World!

Anybody who comes to you and says he has a perfect language is either naive or a salesman.
-Bjarne Strousrup


This is my first post(as you probably already noticed). This blog will be mainly about TBS(To Be Simple), a programming language I created. Please do not expect it to be a language even comparable to most programming languages out there today. But TBS has a number of features which are interesting and it has a purpose.
Besides that, I will also write about other things related to computer-science.
The current download for TBS(debian package): http://www.mediafire.com/?7hdbhs6g0oty86k.
For a language summary, look in /usr/bin/tbs-doc/summary.pdf or here.

A windows binary will be created later(and I will add some more information tomorrow?).
Well, I guess that's all... for now.