| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Did you ever wake up and think "FORTH is just too darn easy -- I need a *real* challenge"? Straight from Prfnoff himself, I present to you the BAK programming language... !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! BAK: It's Not Forth The only source file extension BAK recognizes is ".bak" (or ".BAK"), and the BAK interpreter enforces this. This guarantees some confusion with automatically generated backup files. The only data type in BAK is the pointer, but it shall be referred to as the 'BAKword'. Every BAKword points to a character, but it shall be referred to as the BAKword's 'reverse'. These BAKwords are kept on a data structure called the 'LIFO'. The position starts at the first reverse of the program. After executing the feature at the position, the position is incremented unless the feature otherwise specifies. Data space is identical to program space. A BAK program may end only if it reaches the point exactly after the last position, with the LIFO in its original state. BAK has an unlucky number of instructions: 13. It is hard to say whether the unlucky properties apply to the programmers or implementers. These thirteen features are described by name below. The here feature ($) takes the position as a BAKword and adds it to the LIFO. The there feature ( pulls a BAKword from the LIFO andsets the current position to it. The low feature (<) pulls two BAKwords from the LIFO and replaces the lower one. The high feature (>) pulls two BAKwords from the LIFO and replaces the higher one. The math feature ( pulls three BAKwords from the LIFO andreplaces the third after adding the second subtracted from the first. The attract feature (+) pulls two BAKwords from the LIFO and hides a datum from the source in the reverse of the second BAKword, unless the source is dry, in which case the position becomes the first BAKword. The repel feature (-) dumps the reverse of a BAKword pulled from the LIFO in the sink. The toss feature (@) pulls three BAKwords from the LIFO, and starting at the second searches for the reverse of the third, incrementing, and ending either at the first or when the reverse of the third is found. It then adds the resulting BAKword to the LIFO. The send feature (=) pulls two BAKwords from the LIFO, and replaces the reverse of the first with the reverse of the second. The breed feature (*) pulls a BAKword from the LIFO and replaces it twice. The twiddle feature (/) pulls two BAKwords from the LIFO and replaces the first and second, in that order. The twoddle feature (\) pulls three BAKwords from the LIFO and replaces the first, third, and second, in that order. The trash feature (!) pulls a BAKword and shreds it. Any feature not on this list is silently overlooked. The float (.) is commonly used for this purpose. BAK.C -- The BAK interpreter #include <stdio.h> #include <stdlib.h> #include <string.h> #define F(I)I=*--c, #define P(C),q-*#C||( char**c,**d,**e,*f,*g,*h,*i,*j,*p;int k,l,q,z=-1;size_t n,o ;FILE*m=NULL;int main(int a,char**b){c=d=e=NULL,f=g=h=i=j=N ULL,a&&(p=strchr(b[1],'.'))&&!(strcmp(p,"\.bak")&&strcmp(p, ".BAK"))&&(m=fopen(b[1],"r")),(l=!m)&&(m=stdin);for(n=o=0;o >=n;(g=realloc(g,n+=256))?(h=&g[o+=fread(&g[o],1,256,m)]) ![]() exit(2),g));for(f=g;f-h||c-d;f=p)q=z[p=f+1],(k=q-'$')&&q-'* '||(c<e||((d=realloc(d,((o=c-d)+10)*sizeof*d))?(e=(c=d+o)+1 0) exit(2),d)),*c=k?c[z]:f,c++)P( p=*--c)P(<)F(j)F(i)*c++=j<i?j:i)P(>)F(j)F(i)*c++=j>i?j:i)P( F(j)F(i)c[z]+=j-i)P(+)F(j)F(i)(k=getchar())-EOF?(*i=k,p) p=j))P(-)putchar(**--c))P(@)F(j)F(i)i=memchr(i,*c[z],j-i),c[z]=i?i:j)P(=)F(j)*j=* *--c)P(/)i=c[-2],c[-2]=c[z],c[z]=i)P(\\)i=c[z],c[z]=c[-2],c [-2]=c[-3],c[-3]=i)P(!)--c);l||fclose(m),free(d),free(g),ex it(0);} BAK-NEW.C -- The New BAK interpreter #include <stdio.h> #include <stdlib.h> #include <string.h> #define F(I)I=*--c, #define P(C),q-*#C||( char**c,**d,**e=NULL,*f,*g,*h,*i,*j=NULL,*p;int k,l,q,z=-1; size_t n,o,y=sizeof*d;FILE*m=NULL;int main(int a,char**b){c =d=e,f=g=h=i=j,a&&(p=strchr(b[1],'.'))&&!(strcmp(p,".bak")& &strcmp(p,".BAK"))&&(m=fopen(b[1],"r")),(l=!m)&&(m=stdin);f or(n=o=0;o>=n;h=(g=realloc(g,n+=256))?&g[o+=fread(&g[o],1,2 56,m)] exit(2),g));for(f=g;f-h||c-d;f=p)q=z[p=f+1],(k=q-'$')&&q-'*'||(c<e||((d=realloc(d,((o=c-d)+10)*y))?(e=(c=d+o)+ 10) exit(2),d)),*c=k?c[z]:f,c++)P( p=*--c)P(<)F(j)F(i)*c++=j<i?j:i)P(>)F(j)F(i)*c++=j>i?j:i)P( F(j)F(i)c[z]+=j-i)P(+)F(j)F(i)(k=getchar())-EOF?(*i=k,p) p=j))P(-)putchar(**--c))P(@)F(j)F(i)i=memchr(i,*c[z],j-i),c[z]=i?i:j)P(=)F(j)*j= **--c)P(/)i=c[-2],c[-2]=c[z],c[z]=i)P(\\)i=c[z],c[z]=c[-2], c[-2]=c[-3],c[-3]=i)P(!)--c)P(|)i=c[z],c[z]=*d,*d=i)P([)i=c [z],memmove(d+1,d,y*(c-d-1)),*d=i)P(])i=*d,memmove(d,d+1,y* (c-d-1)),c[z]=i)P(^)(i=c[z])<*d||(c[z]=*d,*d=i,0));l||fclos e(m),free(d),free(g),exit(0);} HELLO.BAK -- Hello world! in BAK $....$$\;:H.$*$/;- $....$$\;:e.$*$/;- $....$$\;:l.$*$/;- $....$$\;:l.$*$/;- $....$$\; .$*$/;-$....$$\;:,.$*$/;- $....$$\;: .$*$/;- $....$$\;:w.$*$/;- $....$$\; .$*$/;-$....$$\;:r.$*$/;- $....$$\;:l.$*$/;- $....$$\;:d.$*$/;- $....$$\;:!.$*$/;- $....$$\;: ..$*$/;- Source: http://esoteric.sange.fi/orphaned/bak/ -- Guy Macon <http://www.GuyMacon.com/> Guy Macon <http://www.GuyMacon.com/> Guy Macon Guy Macon <http://www.GuyMacon.com/> Guy Macon <http://www.GuyMacon.com/> Guy Macon Guy Macon <http://www.GuyMacon.com/> Guy Macon <http://www.GuyMacon.com/> Guy Macon Guy Macon <http://www.GuyMacon.com/> Guy Macon <http://www.GuyMacon.com/> Guy Macon |
|
#2
| |||
| |||
| On Tue, 12 Aug 2008 20:59:42 +0000, Guy Macon wrote: > Did you ever wake up and think "FORTH is just too darn easy -- I need a > *real* challenge"? Straight from Prfnoff himself, I present to you the > BAK programming language... Wow, add the BAK authors to the list of those Desperately Needing To Get A Life |
|
#3
| |||
| |||
| Many things look better than the code of BAK A few simple definitions are * DUP = SI SO BA SO * EXIT = RI SI BA SO * CLC = LIT 0 DUP FA BA BO * XOR = CLC SI DI BA SO * NOT = LIT -1 BA XOR * (LIT) = RI SO RI FA RO SE SWAP SI RO EXIT * 0BRANCH = NOT DUP LIT 1 FA SI SU (LIT) GO RI RO EXIT These are compact definitions, (except for 0BRANCH) and many pairs and triplets of instructions would be defined for greater factoring. What is its unique selling point? More closely resembles SK machine? cheers jacko |
|
#4
| |||
| |||
| jacko wrote: >What is its unique selling point? BAK was created purely for entertainnent value. Take a look at these: http://compsoc.dur.ac.uk/whitespace/ http://catseye.tc/projects/befunge93/doc/befunge93.html http://www.lscheffer.com/malbolge.shtml http://www.madore.org/~david/programs/unlambda/#what_is http://esoteric.sange.fi/orphaned/bak/BAKref.txt http://www.catb.org/~esr/intercal/ -- Guy Macon <http://www.GuyMacon.com/> |
|
#5
| |||
| |||
| How did you manage to forget Brainfuck? http://esolangs.org/wiki/Brainfuck Virtually, Michael Morris. |
|
#6
| |||
| |||
| morrimichael@gmail.com wrote: > >How did you manage to forget Brainfuck? > >http://esolangs.org/wiki/Brainfuck I ommited it because I don't like the name. I don't like the name because it triggers spam filters. Hmmm. Microsoft Viagra++ has a nice ring to it... -- Guy Macon <http://www.GuyMacon.com/> |
|
#7
| |||
| |||
| On Aug 23, 6:47*pm, Guy Macon <http://www.GuyMacon.com/> wrote: > Hmmm. Microsoft Viagra++ has a nice ring to it... > No, thanks. I don't like hard languages. -Brad |
|
#8
| |||
| |||
| Brad Eckert wrote: > >Guy Macon <http://www.GuyMacon.com/> wrote: > >> Hmmm. Microsoft Viagra++ has a nice ring to it... >> >No, thanks. > >I don't like hard languages. I work mostly with firmware... What really made the Microsoft Viagra++ project go limp was the customers. They seemred to have a problem buying such a product from a company with "Micro" and "Soft" in the name. That and the well-known performance issues. -- Guy Macon <http://www.GuyMacon.com/> |
|
#9
| |||
| |||
| On 26 Aug, 08:23, Guy Macon <http://www.GuyMacon.com/> wrote: > Brad Eckert wrote: > > >Guy Macon <http://www.GuyMacon.com/> wrote: > > >> Hmmm. Microsoft Viagra++ has a nice ring to it... > > >No, thanks. > > >I don't like hard languages. > > I work mostly with firmware... > > What really made the Microsoft Viagra++ project go limp was the > customers. *They seemred to have a problem buying such a product > from a company with "Micro" and "Soft" in the name. *That and > the well-known performance issues. There seems to be too much focus on how hard it is. A little more thought should be given to the end user experience ;-) cheers jacko |
|
#10
| |||
| |||
| jacko wrote: > On 26 Aug, 08:23, Guy Macon <http://www.GuyMacon.com/> wrote: >> Brad Eckert wrote: >> >>> Guy Macon <http://www.GuyMacon.com/> wrote: >>>> Hmmm. Microsoft Viagra++ has a nice ring to it... >>> No, thanks. >>> I don't like hard languages. >> I work mostly with firmware... >> >> What really made the Microsoft Viagra++ project go limp was the >> customers. They seemred to have a problem buying such a product >> from a company with "Micro" and "Soft" in the name. That and >> the well-known performance issues. > > There seems to be too much focus on how hard it is. A little more > thought should be given to the end user experience ;-) > > cheers > jacko And avoiding the Blue-Pill Screen of Death |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.