Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

The Japh programming language

by jima (Vicar)
on Jun 26, 2001 at 21:46 UTC ( #91684=obfuscated: print w/replies, xml ) Need Help??

package Language::Japh; =pod =head1 NAME Language::Japh - Little language for creating JAPHs =head1 SYNOPSIS use Language::Japh; $j = Language::Japh->new($PROGRAM); $j->execute; =head1 DESCRIPTION Have you ever looked at the Obfuscated JAPHs posted online, and wondered how to get started on writing your own? Or maybe you've written some in the past, and are fresh out of ideas on how to write new ones. Enter Japh! Japh (pronounced to rhyme with "chaff") is a very simple language for writing JAPHs. This script includes the complete Japh parser as a Perl 5 module, so you can get started right away on creati +ng brand new JAPHs. Unfortunately, I'm still working on the syntax of the language, so I don't have a complete instruction set. But this script contains an example Japh language program at the very end, so you can get a feel o +f how the syntax works. The instructions are also commented, in case you need some additional help. Coming soon: the Japh programmer's reference, desktop ref, T-shirt, Website, ad banner, ballcap, IRC channel, mailing list, AYB image, PowerPoint presentation, dog bandanna, O'Reilly book, and geek cruise. I even got a good slogan: "It's not JAPH or japh -- it's Japh!" =head2 METHODS =over =item $j = Language::Japh->new($CODE); Creates a new Japh parser object. Pass to the constructor your program code. =item $j->execute(); Executes the code associated with the Language::Japh object. =back =head1 BUGS No diagnostic messages yet. I'll get around to it. =head1 AUTHOR James Allenspach, E<lt>jima@mcs.netE<gt> =head1 SEE ALSO L<perl>. =cut use strict; sub new { my $self = shift; my $class = ref $self || $self; $self = bless {}, $class; # Had to encode the parser inline, sorry s&|!0/pp&AeYswNzQmgm-NWi-x-Z-6ffisx"Y^ymXyxW0M!p&, s&oO2Wm0eVy&WY!ttPxg7W{-e2p^o^oit!{!VoemyQm/Qy O&, s&WYNeN`e!eY!!0exQfeyVY!p&!a{AeXmoIt[P6^ y|Nx!x[&, s&a`eoqWyp"VWpVZIyy`yo&WiZ!Q-f[-/im5Z7ze5byOzZ^x&, s&!NYUo-5|!b&tXWpWQaYtN7P^e!xp!IQy[e^t6eQx!tM[-m&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[Q[fx-ZZiY&, s&Mow&5mtIZ{Ny{[2X!2{e[QN#-0Wm6Wef6Q6m[sIiIOAWw-&, s&AYW#emQtxy2efQI{!ImeWZoI`&ZtYQe2|{eQ^[f!-Xe!VU&, s&o}-PN&eZQ2eex/^YzztxWMNpWYtXN!^-[!!Yt-btm2I2yN&, s&e!!`ZXAyZ`maZ &pp{we2YeZ-em-_Q{-W"ye{ !W`tpXe{&, s&xZ}^t{ZNI2Vt{{!!x2pV&tt!Zm!p6ZNNtxXXN!!!a2!pb`&, s&Nz{YZmmQQ &pN ^NeZpybt -{wo}gYZ }Nyx"!s[zYxQWm&, s&tQ-geoZxYAm!bx{6ex&Wmf{Mt!WZ!b{sx!zQ!!zOo^/we#&, s&g6-z"bot!XP20Wsy2&W^-mwPoZXe/e!{!xx`2pte-#yUwq&, s&Q{#&^-zz`ym7zty{"^y0eXw[eIVP55^Xzm!^p!{s2"QU5o&, s&!we-wQWpmtwWe!py&{Z-xXg!`[t!fYtAz!!e{NNbx"{!Pb&, s&OepezQ!Q!tieNoZp5YWNewYeA&7{oUyeb!yeVZm^QIwQ!i&, s&p&e!teZ`f-!^f5VY!AytW`Z`[yNQb}eoe!y!X!!WAasbI5&, s&"!ieeU^VN fZN&+and+or+not+eval+sin+cos+tan+pop&, s&Ms!Z/eP- {`oxoy,tNme22b&+push+pack+unpack+else&, s&6eb_Qze&+if+elsif+print+pop+join+map+grep+sort&, s&!!oZ`&0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ#{}!&, s&mI`-!p/-!$&+},rekcah lreP rehtona tsuJ{q+tnirp&, return $self; } sub execute { my($self) = shift; my($op) = shift @{$self->{CODE}}; ## OPCODE TO EXECUTE if (ref $op eq 'CODE') { ## SUBROUTINE DATA &{$op}($self); warn "subroutine error: $!" if $!; } elsif (ref $op eq 'HASH') { ## DATASET for (sort values %$op) { print $_ if ref eq ''; # print only scalars } } elsif (ref $op eq 'SCALAR') { ## SCALAR DATATYPE print $$op; } elsif (ref $op eq 'ARRAY') { ## ITEMLIST print join ' ', @$op; } else { ## DEFAULT: CHAR DATA print chr $op; } return $self->execute if @{$self->{CODE}}; } package main; # and finally, our example! my($japh) = Language::Japh->new(<DATA>); $japh->execute(); print "\n"; __END__ PROGRAM JAPH; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! !!! !!! PROGRAM: JAPH !!! !!! AUTHOR: JIMA !!! !!! DATE: 2001-JUN-22 !!! !!! !!! !!! THIS IS A DEMO PROGRAM TO SHOW THE BASIC !!! !!! PROPERTIES OF THE JAPH PROGRAMMING LANGUAGE. !!! !!! IT SHOULD BE OBVIOUS WHAT THIS PROGRAM DOES; !!! !!! CHECK THE COMMENTS IF CLARIFICATION IS !!! !!! NEEDED. !!! !!! !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! X,Y: INTEGER; !! OUR COEFFICIENTS Z,W: FLOAT; !! ITERATORS A,B: BINARY; !! CAKE FROSTING CLR(PC); !! RESET PROGRAM COUNTER ASSOCIATE(INTEGER); !! DO INTEGER MATH X:=A+#75; !! CONSTANT ADDITION Z:=Z+W; !! SELF-REFERENTIAL CALCUALTIONS A:=W(BINARY); !! BINARY DATA? Y:=#40(CHAR); !! STRONG TYPING? B:=#99*Y; !! 99 OCT(??) B:=B(CHAR); !! SELF-EXPLANATORY CLR(PC); !! RESET THE PC POPSTACK(#01); !! RETURN TO CALLING PROGRAM Y:=#40+B; !! SPACE? Y:=Y(CHAR); !! TYPE? B:=#40(POPSTACK()); !! OF COURSE! XOR(PC); !! NOW PRINT OUT RESULTS Y:=#40(CHAR); !! Y IS ITEM DELIMITER CHRFORMAT(<<<<SSSSSSS); !! OUTPUT FORMAT FOR STRINGS NUMFORMAT(<<FFFFFFFFF); !! OUTPUT FORMAT FOR NUMERICS P(#01,INTEGER); !! DATA IS INTEGER TYPE P(#01,Y); !! PRINT RESULTS Y:=Y(CHAR); !! TYPECAST Y VARIABLE, FOR THE NEXT PROG R +UN STOP PROG.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://91684]
Approved by root
and the monastery is silent...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2017-01-19 20:10 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (172 votes). Check out past polls.