PiHiPi - Extended PHP Parser

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

PiHiPi - Extended PHP Parser

Post 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();
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post 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 :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

It's on sitepoint in the author's sig ;)
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

jayshields wrote:I'm sure I saw this in someones sig the other day...
Yes, you did: stereofrog's profile
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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?
User avatar
dreamscape
Forum Commoner
Posts: 87
Joined: Wed Jun 08, 2005 10:06 am
Contact:

Post 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 :-)
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post 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.
(#10850)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post 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.
User avatar
stereofrog
Forum Contributor
Posts: 386
Joined: Mon Dec 04, 2006 6:10 am

Post 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.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

So, it has nothing to do with PHP except to the similar syntax, right?
User avatar
stereofrog
Forum Contributor
Posts: 386
Joined: Mon Dec 04, 2006 6:10 am

Post 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.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Yes, but it doesn't use the Zend Engine or anything from PHP - that's what I understand from your previous post.
User avatar
stereofrog
Forum Contributor
Posts: 386
Joined: Mon Dec 04, 2006 6:10 am

Post 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.
Post Reply