Skip to content

juliend2/phlower

Repository files navigation

                    __
                .-.'  '.-.
             .-(   \  /   )-.
            /   '..pHPh..'   \
    ,       \.--.hPHPHPHp.--./
    |\  ,   (   :hPHPHPHp:   )
   _\.\/|   /'--'pPHPHPHp'--'\
   '-.. ;/| \   .''pHPh''.   /
   .--`'. :/|'-(   /  \   )-'
    '--. `. / //'-'.__.'-;
      `'-,_';//      ,  /|
           '((       |\/./_
             \\  . |\; ..-'
              \\ |\: .'`--.
               \\, .' .--'
                ))'_,-'`
               //-'
              // 
             //
            |/

==Introduction==
phlower (pronounced flower) is a small ruby script that compiles the Awesome code (invented by MACournoyer for his book http://createyourproglang.com/ ) into PHP code.
This script is written in Ruby and it depends on the racc gem.

==Usage==

input.aw file should contain your Awesome input code :
 
class Awesome{
  def init(){
    pass();
  }
  
  def x(){
    return(2 + 2);
  }

  def z(){
    print("poulet");
  }
}

aw = Awesome.new();


And :
$ ruby phlower.rb input.aw compiled.php

Should output this PHP code :
<?php

class Awesome{

function __construct(){
pass();
}

function x(){
return(2 + 2);
}

function z(){
print("poulet");
}

}

$aw = new Awesome();


==FEATURES==
Here are a few language features that phlower supports :
* classes & methods
* if..else
* assignation operator
* binary operators
* string, boolean and int types
* converts init() constructors to __construct() php's constructors

==TODO==
* indent outputted php
* comments
* object properties access
* static class method access Class.method() => Class::method()
* elsif
* foreach
* while, do..while
* for
* switch..case
* try..catch
* arrays
* ++,--,+=,-=,*=,/=,.=,%=,!,!=,||,&&,==,>,<,<=,>= operators
* break, continue
* constants defined with define()
* extends (for classes)
* type-casting , eq: (int)$var

About

convert awesome's syntax into php

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published