Thursday, April 19, 2007

I am High!!



begin
const n=10;
integer array A[n];
integer x,i;

proc Sort
begin
integer k,x;
i:=1;
k:=n;
do ~(k<1)>
i:=1;
do i
if A[i]>A[i+1] ->
x:=A[i];
A[i]:=A[i+1];
A[i+1]:=x;
[]
1=1 -> x:=1;
fi;
i:=i+1;
od;
k:=k-1;
od;
end;

$Input Table:
i:=1;
do ~(i>n)->read A[i];i:=i+1; od;

$ Test Sort:
i:=1;
call Sort;
do ~(i>n)->write A[i];i:=i+1; od;

end.


Hmm.. before you bombard me with any questions, let me answer them all..
1) What Language is that?
Ans: PL

2)What does it do?
Ans: Its a really bad inefficient implementation of bubble sort.

3)Does it actually compiles and runs?
Ans: Yes, Of Course.

4)How do I know it?
Ans: Cause I WROTE THE COMPILER!!! I can not express in words, how elated I am. Well, of course, its just another project. But.. its a friggin compiler!! I wanted to make one, when I first came to know about them(about 10 years ago).. It's totally surreal. It gives me error messages when I make an error(Type error, Syntax error, out of Scope etc etc) and it took almost 3 months to finish it (well.. only 2 weeks for coding though). It totally amazes me that how a figment of my imagination can suddenly become so tangible, so real.. so alive.

Sincere thanks to Dr Per Brinch Hansen, for helping me realize a dream. Its been a pleasure being his student.

There is also sadness deep inside.. I realize that I may not get to work on a compiler ever again in my life..but there is hope..
If I have a geeky kid or a grandkid, you know what stories I will be telling them :P

4 comments:

  1. i knw u love linux more than u wud love ur wife but this post labeled as linux ?? i dnt get it ..

    ReplyDelete
  2. well it was developed on linux (although java is platform agnostic)..
    linux plays a huge role in my productivity and all the projects I do are directly related to it..

    neway I totally agree with you.. the label is not correct..

    ReplyDelete
  3. The last place I wish to see Per Brinch Hansen mentioned, Anyways It is not the compiler, not Dijikstra's PL, but it is the guy who taught you. He is the dude. Someday you will know.
    Wow time absolutely wasted in visiting this blog. Should rather get back to work,
    Grow up!!!

    ReplyDelete
  4. @Anonymous: The fact that you hate him, proves that you know him.. which means either you graduated from caltech some 30 years ago or are/were his student. If that is the case then you have the right to form an opinion.. then you go ahead and indirectly criticize the blog.. well you used your right again..
    But atleast have the guts to own up to it.

    "Grow up!!" if that means leaving anonymous comments maligning someone.. i'd rather be a kid.

    BTW I am rather curious; what did he do to you that caused such an emotional trauma??...
    Peace

    ReplyDelete