[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] NegaPosi Compiler

SASADA Koichi

5/10/2005 10:09:00 AM

Hi,

I release NegaPosi Compiler 0.0.0+- on my diary page.
http://www.namikilab.tuat.ac.jp/~sasada/diary/20050...

NegaPosi is my new scripting language. Scripts written by NegaPosi
can run on ruby interpreter.

You can convert any Ruby scripts to NegaPosi scripts using NegaPosi
compiler.


Thanks,
--
// SASADA Koichi at atdot dot net
//

// Yes, it's a only joke software :)



6 Answers

Ryan Leavengood

5/10/2005 11:35:00 PM

0

SASADA Koichi wrote:
> Hi,
>
> I release NegaPosi Compiler 0.0.0+- on my diary page.
> http://www.namikilab.tuat.ac.jp/~sasada/diary/20050...

Hahaha, I actually wrote one of these too, and was going to post it, but
darn it, you beat me to it :)

I think mine is simpler though ;)

Ryan

P.S. I'll post it later, it isn't on my current machine.


Ryan Leavengood

5/11/2005 3:58:00 AM

0

Ryan Leavengood wrote:
>
> P.S. I'll post it later, it isn't on my current machine.

If anyone is interested, here is my NegaPosi generator:

def generate_np(str, width=64)
(str+"\0").gsub(/./) do |b|
("%08b"%b[0]).tr('01','-+')
end.scan(/[-+]{#{width}}|[-+]+/) do |line|
puts line.reverse.ljust(width)+'_'
end
end

It can take a parameter to output different widths (which don't affect the
processing of the NegaPosi "code.") I took a more functional approach in
this, but I suspect SASADA Koichi's is more efficient.

Ryan



Paul Battley

5/11/2005 9:13:00 AM

0

Here's a (long) one-liner to do the same, taking advantage of
pack/unpack's "b" specifier:

str.scan(/.{1,8}/m).map{ |s| s.reverse
}.join.unpack('b*')[0].tr('01','-+').scan(/.{1,64}/).map{ |s| (s << ('
' * 64))[0,64]<< '_' }.join("\n")

Paul.


Paul Battley

5/11/2005 9:16:00 AM

0

> Here's a (long) one-liner to do the same, taking advantage of
> pack/unpack's "b" specifier:
>
> str.scan(/.{1,8}/m).map{ |s| s.reverse
> }.join.unpack('b*')[0].tr('01','-+').scan(/.{1,64}/).map{ |s| (s << ('
> ' * 64))[0,64]<< '_' }.join("\n")

OK, that *was* one line before I posted it. Let's try again:

str.scan(/.{1,8}/m).map{ |s| s.reverse }.
join.unpack('b*')[0].tr('01','-+').scan(/.{1,64}/).
map{ |s| (s << (' ' * 64))[0,64]<< '_' }.
join("\n")

Paul.


gabriele renzi

5/11/2005 12:47:00 PM

0

SASADA Koichi ha scritto:
> Hi,
>
> I release NegaPosi Compiler 0.0.0+- on my diary page.
> http://www.namikilab.tuat.ac.jp/~sasada/diary/20050...
>
> NegaPosi is my new scripting language. Scripts written by NegaPosi
> can run on ruby interpreter.
>
> You can convert any Ruby scripts to NegaPosi scripts using NegaPosi
> compiler.

I was somewhat scared that it would compile to yarv bytecode :)

Dave Burt

5/12/2005 3:04:00 AM

0

"gabriele renzi" <surrender_it@remove-yahoo.it> admitted...
> SASADA Koichi ha scritto:
>> You can convert any Ruby scripts to NegaPosi scripts using
>> NegaPosi compiler.
>
> I was somewhat scared that it would compile to yarv bytecode :)

Isn't NegaPosi going to be YARV's intermediate language?! ;-)