Page 1 of 2

PiHiPi - Extended PHP Parser

Posted: Fri Apr 06, 2007 9:29 am
by Chris Corbyn
http://code.google.com/p/pihipi/
http://www.sitepoint.com/forums/showthread.php?t=468605

Thoughts?
PiHiPi wrote:namespaces

Code: Select all

namespace Foo { body }
Namespace body can contain constant, function and class declarations. Qualified name is looked for in that namespace:

Code: Select all

echo Foo::bar();

Unqualified name is looked for in current namespace and than globally. 'global' is a namespace and can be referred as such:

Code: Select all

echo global::foo;

Code: Select all

import <namespace-name>
import <namespace-name> from <path>
imports another namespace in the scope of current.

classes
'extends' accepts qualified class names:

Code: Select all

class Foo extends OtherNamespace::Bar
Constants are resolved at run-time, that is, arbitrary expressions are allowed on the right:

Code: Select all

const X = foo() + bar();

Posted: Fri Apr 06, 2007 9:31 am
by jayshields
I'm sure I saw this in someones sig the other day... no doubt they'll post here and tell you all about it :)

Posted: Fri Apr 06, 2007 9:31 am
by Chris Corbyn
It's on sitepoint in the author's sig ;)

Posted: Fri Apr 06, 2007 10:02 am
by Oren
jayshields wrote:I'm sure I saw this in someones sig the other day...
Yes, you did: stereofrog's profile

Posted: Fri Apr 06, 2007 11:44 am
by RobertGonzalez
It is stereofrog's app. I actually posted this exact same thread in GD a few days ago, then squashed it (didn't want to steal stereofrog's thunder around here, you know?).

Seems pretty cool.

PS : Sterefrog frequents sitepoint more than here, though I think I am seeing more and more of him. Are we winning sitepointers over to the ways of the PHPDN?

Posted: Fri Apr 06, 2007 12:13 pm
by dreamscape
Everah wrote:Are we winning sitepointers over to the ways of the PHPDN?
lol... I actually had an account here first, but up until about a week ago frequented Sitepoint much more often... one reason I came back is that the "PHP Application Design" forum at Sitepoint has been getting rather boring and slow over the past few months... it is either the same old thing over and over, or nothing really interesting at least... For example, I don't think I can count the number of nearly identical ORM threads there have been in the past couple months... ORM is a great topic and there are many areas to explore, but ughh, we don't really need to re-explore the same areas every week (even sometimes multiple times per week). You know what I mean?

Most of the "advanced" PHP users don't seem to be posting as much there anymore either... Not sure what has happened but I guess a lot of people may be busy or may have just moved on. It is certainly not what it was a year ago, that much is for sure.

So I came back to PHPDN! I still visit Sitepoint though, but my post frequency has gone way down.

*edit* Or maybe it is not Sitepoint that has changed, but it is I that have changed... either way glad to be here :-)

Posted: Fri Apr 06, 2007 3:27 pm
by Christopher
dreamscape wrote:So I came back to PHPDN! I still visit Sitepoint though, but my post frequency has gone way down.

*edit* Or maybe it is not Sitepoint that has changed, but it is I that have changed... either way glad to be here :-)
I for one am glad you are spending more time here. Though we don't always agree ;) I appreciate your contributions to the discussions here.

Posted: Fri Apr 06, 2007 3:41 pm
by RobertGonzalez
Well I too am glad to have sitepointers here. I visit their forums every now and again. Mostly when things get slow here. I like their forums and all, but I like the atmosphere better here.

Anyway, enough about this mess. Sorry for derailing yet another thread.

scampers off wondering how I stay a moderator sometimes

Posted: Sat Apr 07, 2007 12:06 pm
by Ambush Commander
(back on track)

I like some of the innovations, esp the shortcut array syntax. How exactly does it work? Does it convert the extended PHP code into valid PHP code, or does it modify PHP itself?

Posted: Sat Apr 07, 2007 4:00 pm
by Weirdan
Ambush Commander wrote:How exactly does it work? Does it convert the extended PHP code into valid PHP code, or does it modify PHP itself?
It's another PHP.

I wonder if it supports extensions designed for official PHP.

Posted: Mon Apr 16, 2007 4:47 am
by stereofrog
Thanks everyone for the opinions.
Ambush Commander wrote:
I like some of the innovations, esp the shortcut array syntax. How exactly does it work? Does it convert the extended PHP code into valid PHP code, or does it modify PHP itself?
The compiler converts PiHiPi code to the input language of the neko virtual machine (http://nekovm.org), which can be executed directly or converted to a binary (.exe) file. The next version of PiHiPi will also target php itself.

Weirdan wrote: It's another PHP.
No, it is not. The goal of the project is to create a complete and consistent parser for php syntax. It's not meant as a replacement or competitor to php.

Posted: Mon Apr 16, 2007 6:02 am
by Oren
So, it has nothing to do with PHP except to the similar syntax, right?

Posted: Mon Apr 16, 2007 6:26 am
by stereofrog
wrong ;)

The syntax is not "similar" to php, it's the syntax of php. With some exceptions, PiHiPi is able to compile any valid php code, that is, syntactically it's a superset of php.

Posted: Mon Apr 16, 2007 6:47 am
by Oren
Yes, but it doesn't use the Zend Engine or anything from PHP - that's what I understand from your previous post.

Posted: Mon Apr 16, 2007 9:16 am
by stereofrog
This is correct, but you're missing the point, I'm afraid. PiHiPi is not a development platform, it's just a parser. Its purpose is to convert "extended php" programs to a target virtual machine language, which happens to be neko at the moment, but could be also JavaWM, Parrot, Zend Engine or even machine code.