Results 1 to 4 of 4

Thread: Phoil!

Threaded View

  1. #1

    Thread Starter
    Addicted Member Cuallito's Avatar
    Join Date
    Apr 2001
    Location
    You know that chest that you could never get opened? If you ever do, I'm there.
    Posts
    136

    Cool Phoil!

    These are some samples from a programming language that i'm thinking about amking, I'm calling it PHOIL for Polymorphic Hierchial Object Instruction Language. Please post any comments or critisism, just not anything like "Its OK".

    Code:
    //Hello world program
    
    include "std.plh" /* Standard header for Phoil progs. 
                               All most everything will come from a header file
                               Like in C++ */
               
    //main is the startup object in phoil progs
    
    main is textout("Hello World\n"); //;Blocks of code
    // is makes the main object 'be' textout("Hello World\n")
    Was that so bad?

    Code:
    include "std.plh" 
    
    /*An object can contain many elements (like sequences in euphoria).
    An element can be named or unamed, receive arguments, and return values.
    An element with the same name of the object is the constuctor 
    and an element with the name of the object and a ~ before it is the deconstructor */
    
    main = {
            private Tom=New Surfer    
            ::main() //constructor
                 Tom::Cool!() 
                 Tom[0]() //Same as above
              //You can also access elements like elements of arrays in C 
                 Tom::Money(Tom(3))
            ::~main() //deconstructor
                 Tom = nothing //nothing is {}
    }
    
    Surfer = { /* Phoil has bad grammer rules :p 
                        This object doesn't need a constructer 
                        (there are no variables. All elements are public by
                        default */
          
          ::Cool!() //! isn't a special character
                    textout("Whoa, Cool!\n")
                    textout("That's totalllly chilin'\n ")
    | //new element character
          ::Dude()
                    textout("Sweeet dude!\n")
    |
          3 //unamed data
    |
          ::money(howmuch) 
    
                /* there is only one type of data in phoil: objects */
    
                textout("Can I have" & 'howmuch' & "dollars")
    |
          ::static private smoke_weed() //you get the idea
    /*To use functions simply put return n somewere in them. To use
    events just do ::Event foo(x,y,z) or whatever /*
    
    }
    Do you like?

    Code:
    include "std.plh" 
    
    //Demonstrates Polymorphism in Phoil and Heirarchy
    
    main is 
                 private a ,b ,c // all variable are set to {} unless 
                                       //otherwise specified
                 a is textout("Eat Cheese");
                 b is textout("Water is clear");
                 c={a,{a,b}}
    /* c is now
    
    c={
         textout("Eat Cheese"),{textout("Eat Cheese"),textout("Water is clear")}}
    
    */
    
                c[0] //prints Eat Cheese on the screen
                c[1] //prints Eat Cheese AND Water is clear on the screen
                c[1,0] //Prints Eat Cheese on the screen
                c[1,1] //Prints Water is clear
    ;
    Well, what do you think?
    Last edited by Cuallito; Jun 11th, 2001 at 06:08 PM.
    BTW, Thanks for all your help

    Member of the anti-gay cross-dressing trans-species wolves alliance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width