The Artima Developer Community
Sponsored Link

PHP Buzz Forum
Parsing PHP in D.

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Alan Knowles

Posts: 390
Nickname: alank
Registered: Sep, 2004

Alan Knowles is Freelance Developer, works on PHP extensions and PEAR.
Parsing PHP in D. Posted: May 31, 2006 6:08 PM
Reply to this message Reply

This post originated from an RSS feed registered with PHP Buzz by Alan Knowles.
Original Post: Parsing PHP in D.
Feed Title: Smoking toooo much PHP
Feed URL: http://www.akbkhome.com/blog.php/RSS.xml
Feed Description: More than just a blog :)
Latest PHP Buzz Posts
Latest PHP Buzz Posts by Alan Knowles
Latest Posts From Smoking toooo much PHP

Advertisement
I keep meaning to write a full log of the whole mythtv experience, as the number of hardware headaches that that has gone through is enough for at least 4 or 5 posts (including the need to rebuild from scratch this whole server a few weeks ago due to hard disk failures from overheating..). But this week, for what seems like the first time this year, I actually scraped 2 days to work on yet another new pet project. Phpmole's replacement....

Phpmole is my lifeblood for development, when I wrote it, I added all the features that where missing from other editors, and the resulting editor made a huge difference to my productivity.
  • code folding
    Although annoying at times, is a good way to dive into new code.
  • autocompletion
    look up PHP functions / variable names etc.
  • inline help hints
    show the signature of a php method inline.
  • List of open files on a left bar.
    Since I often have 30+ files open, this is very usefull to flip between them.
  • Standard editor features, like syntax highlighting etc.

However Phpmoles code base is now pretty old, and was written before I did much PEAR work (eg. it's messy....). There are alot of design decisions that related to PHPGTK1, and the need at the time to implement file transports (ssh/midgard/file) etc. Which are now redundant as things like sshfs do that much better.

So I've started hacking on leds, the editor I mentioned before when hacking on D. It has the benefit of being relatively small codebase wise, and very easy to understand. Let alone it's fast and runs as a binary, so I can eventually just compile the lib's and distribute them, rather than a huge array of php files.

Anyway, the first stage in the great conquest was to teach leds a little about PHP. So starting with Zend's lexer, I hand crafted a reasonably complete lexer in D, (it ignores variables in quoted strings, and heredocs), but should be enough to grab defined classes/methods/vars etc. and work out where to put the folding...

While at present, it's has a few in-efficiencies, as the design was a little organic. It is however quite an interesting way to build a generic language parser and only took 2 days to write and test.. http://www.akbkhome.com/svn/D_Stuff/leds/PhpParser.d

Read: Parsing PHP in D.

Topic: How To Create AJAX Commenting System for Static HTML Pages Previous Topic   Next Topic Topic: WordPress Source Code Cross Reference w/ Commenting for Plugin / Theme / Code Developers

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use