Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 7cff4a527d
Fetching contributors…

Cannot retrieve contributors at this time

98 lines (78 sloc) 1.836 kB
__
.-.' '.-.
.-( \ / )-.
/ '..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
Jump to Line
Something went wrong with that request. Please try again.