[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - PocoScript on steroids

PocoScript on steroids

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

PocoScript on steroids

Postby djgtram » Mon Oct 24, 2005 10:23 am

Hello,

I'm working on a small translator that would allow us to write our scripts in a more comfortable environment, including structured statements (if-then-else, while-do, repeat-until, for, select-case) and full expressions (arithmetic, logical, string). With my current approach, you can write your scripts in, say, a .pos file, and use the translator to convert it into the traditional PocoScript .poc for PocoMail to run them.

To give you an idea, here is a simple script to remove deeply quoted lines when a message is replied to:

Code: Select all
AppendToFile (true)
SaveMessage (%message, "Trash")

$Body = ReadBody (%message)

for #i = LineCount ($Body) downto 0 do
  $Line = GetLine ($Body, #i)
  if (StringPos (">>", $Line) ! 1) and (StringPos (">>>", $Line) ! 1) and (StringPos (">>>>", $Line) ! 1) and (StringPos (">>>>>", $Line) ! 1) and
     (StringPos ("> >", $Line) ! 1) and (StringPos ("> > >", $Line) ! 1) and (StringPos ("> > > >", $Line) ! 1) and (StringPos ("> > > > >", $Line) ! 1) then
       DeleteLine ($Body, #i, 1)
  endif
endfor

AssignBody (%message, $Body)

SaveMessage (%message, $CurrentMailbox)
DeleteMessage (%message)


Anybody interested in trying it out? :-) Please, note that it might not yet be ready for real use, there will be errors and problems, so I'd prefer people who would test it to those who expect it to work immediately.

I also would like to know the official stance of the PocoMail team on a utility like this. I plan to author a page about it on my web site, and use references to PocoMail, PocoScript with links and kudos, but before I do, I'd want to make sure I'm not stepping on any toes.

Bye,
Gábor (DEÃÂ
djgtram
Resident Poster
 
Posts: 100
Joined: Thu Oct 20, 2005 4:51 am
Location: Hungary

Postby djgtram » Mon Oct 24, 2005 7:14 pm

As a follow-up: the translator as it stands now is not an optimizing one. For those who are knowledgeable about the internal details of compilers: it uses a simpler approach with a lexer and scanner reading the source code and emitting the modified version from the semantic actions of its grammar directly. It doesn't convert the incoming source code into an abstract syntax tree or any other intermediate representation of its own. I plan to rewrite it along these lines later, to make it possible to run various optimization algorithms on the code (the most rewarding ones in our case would probably be constant propagation and short circuit Boolean evaluation) but I'd like to see first how well it suits the practical needs.

Bye,
Gábor
djgtram
Resident Poster
 
Posts: 100
Joined: Thu Oct 20, 2005 4:51 am
Location: Hungary

Re: PocoScript on steroids

Postby robin » Mon Oct 24, 2005 7:49 pm

[quote="djgtram"]I also would like to know the official stance of the PocoMail team on a utility like this. I plan to author a page about it on my web site, and use references to PocoMail, PocoScript with links and kudos, but before I do, I'd want to make sure I'm not stepping on any toes.

Bye,
Gábor (DEÃÂ
robin
 

Re: PocoScript on steroids

Postby djgtram » Mon Oct 24, 2005 8:26 pm

I suggest that you use the private message facility on the forum to send a message to Slaven or Jim: they are more likely to see it that way.


Sent to both of them, thanks.

Bye,
Gábor
djgtram
Resident Poster
 
Posts: 100
Joined: Thu Oct 20, 2005 4:51 am
Location: Hungary

Postby Slaven » Mon Oct 24, 2005 8:35 pm

Thanks for the really neat idea! I'd love to try it, though due to the release, this week is a bit of a write-off for us. Still, you should contact me at support1 at pocosystems.com.
Slaven Radic
Poco Systems Inc
Slaven
Poco Systems Inc
 
Posts: 1644
Joined: Fri Jul 23, 2004 7:37 pm


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 4 guests

cron