I have lately not made any time to post this, but I have now. For a (sort of) description of this language, see this post. I have now given it the ironic name ~English(pronounced NOT English). "lang.syntax" provides a file containing a precise(yet possibly obscure) definition of the language syntax and semantics. I have also included a file "testfile.ext" which contains a hello world program using most of the languages features.
You can download the full package(45.6 KB) here.
An important notice for all users:
This language is, as stated earlier in my last post, an esoteric programming language. This means that it was not created to be functional. The interpreter(written in C++) is very simple and might still contain a number of bugs. It has only be compiled for Linux and this will remain as it currently is.
The TBS Programming Language
The official blog about the TBS(To Be Simple) programming language. Provides information and downloads.
1/24/2012
12/29/2011
An esoteric language
Written by
TBS
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:
The following...
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:
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.
The following is an example of a program written in this language:
Create a variable named name. Display "Enter your name: " and a newline.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". 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.
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:
So, what have I done so far and what are the parameters of the language?
Stop the current program and do something else.
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!
Written by
TBS
// 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
Written by
TBS
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.
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
Written by
TBS
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.
Currently, I'm still looking for another graphics library that might be integrated into TBS.
11/25/2011
Booleans and boolean expressions
Written by
TBS
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.
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;".
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);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.
#func() {
?blnTest =: 1 == 1 && 1 <> 2 && :<>false;
_if(:false || 1>0 && :?blnTest) {
!out(~"New, working expressions! Finally!\n");
}
: : :true;
};
!func();
_die();
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
Written by
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:
Subscribe to:
Posts (Atom)