Login Register






Xitram language interpreter filter_list
Author
Message
RE: Xitram language interpreter #11
(06-10-2013, 12:35 PM)noize Wrote: But this is fucking Cool.

Check out say.php, in the comment you're saying you don't want any additional comment, but that's wrong for sure.

Oops that is what happens when you use one keyword as template for others Smile
fixed, thanks for reporting Smile
Staff will never ever ask you for your personal information.
We know everything about you anyway.

Reply

RE: Xitram language interpreter #12
Don't have a Github account yet, so I'll just push a few PHP commands I translated in Xitram keyword file basing on that template:

file_put_contents(file,data) => writef(file,data)
Code:
<?php class writef implements keywords{ private $error = NULL; //We will store errors here public function error(){ //This will be called when some error is found return $this->error; } public function syntax($string){ if(empty($string)){ $this->error .= "Syntax error. \"writef\" requires additional arguments."; return false; } return true; } public function run($string){ file_put_contents $string; } } ?>

mkdir(dirname, mode, 2 args I can't remember what they do) => newd(dirname,mode,arg3,arg4)
Code:
<?php class newd implements keywords{ private $error = NULL; //We will store errors here public function error(){ //This will be called when some error is found return $this->error; } public function syntax($string){ if(empty($string)){ $this->error .= "Too few arguments for 'newd'."; return false; } return true; } public function run($string){ mkdir $string; } } ?>

I've used two different error messages, I think the latter is the better one (the one for newd).

You shall probably use the same error style for all commands, of course, so choose well.

P.S: I know it's not much, I'll try for something more tomorrow.
My Bitcoin address: 1AtxVsSSG2Z8JfjNy9KNFDUN6haeKr7LiP
Give me money by visiting www.google.com here: http://coin-ads.com/6Ol83U

If you want a Bitcoin URL shortener/advertiser, please, use this referral: http://coin-ads.com/register.php?refid=noize

Reply

RE: Xitram language interpreter #13
(06-10-2013, 11:19 PM)noize Wrote:
Spoiler:
Don't have a Github account yet, so I'll just push a few PHP commands I translated in Xitram keyword file basing on that template:

file_put_contents(file,data) => writef(file,data)
Code:
<?php class writef implements keywords{ private $error = NULL; //We will store errors here public function error(){ //This will be called when some error is found return $this->error; } public function syntax($string){ if(empty($string)){ $this->error .= "Syntax error. \"writef\" requires additional arguments."; return false; } return true; } public function run($string){ file_put_contents $string; } } ?>

mkdir(dirname, mode, 2 args I can't remember what they do) => newd(dirname,mode,arg3,arg4)
Code:
<?php class newd implements keywords{ private $error = NULL; //We will store errors here public function error(){ //This will be called when some error is found return $this->error; } public function syntax($string){ if(empty($string)){ $this->error .= "Too few arguments for 'newd'."; return false; } return true; } public function run($string){ mkdir $string; } } ?>

I've used two different error messages, I think the latter is the better one (the one for newd).

You shall probably use the same error style for all commands, of course, so choose well.

P.S: I know it's not much, I'll try for something more tomorrow.

Perfect! I'll add them tomorrow as I'm off to bed now Smile
Thanks for the contribution Smile

Note: feel free to add your username, credits or w/e as a comment. I'll later on create a "help" command, that will display descriptions etc. of commands Smile
Staff will never ever ask you for your personal information.
We know everything about you anyway.

Reply