CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
PHP Parser

 



trubilo
New User

Jul 28, 2013, 7:10 AM

Post #1 of 4 (868 views)
PHP Parser Can't Post

Hi, there!

I've been given an exercise to create a simple PHP parser according to the EBNF grammar which can be found here. Basically the task is to list all the classes, included files, functions, methods and variables.

When I got this task, my mentor recommended me to use PERL, so I began studying Perl.

So, now that I've got some Perl knowledge (using O'Reilly's book Learning Perl 6th Edition) , and I know PHP very well, I am wondering, what is the simplest way to start?

Is it to convert EBNF to many subroutines with regex, or is there a more elegant way?


Thank you in advance.


(This post was edited by trubilo on Jul 28, 2013, 7:20 AM)


FishMonger
Veteran / Moderator

Jul 28, 2013, 7:24 AM

Post #2 of 4 (861 views)
Re: [trubilo] PHP Parser [In reply to] Can't Post

I don't know anything about EBNF, but the starting point would be to look for related cpan modules.

http://search.cpan.org/search?query=ebnf&mode=all


Laurent_R
Veteran / Moderator

Jul 28, 2013, 10:53 AM

Post #3 of 4 (854 views)
Re: [FishMonger] PHP Parser [In reply to] Can't Post

You might also take a look at Damian Conway's Parse::RecDescent package: http://search.cpan.org/~jtbraun/Parse-RecDescent-1.967009/lib/Parse/RecDescent.pm


2teez
Novice

Jul 28, 2013, 12:32 PM

Post #4 of 4 (853 views)
Re: [trubilo] PHP Parser [In reply to] Can't Post

Just to add to what has been said before now.
While you are it, please look into References and Data Structure those are very important too, IMHO. From you CLI, you can do like thus, to read these documentations:

Code
 perldoc perlref 
perldoc perldsc
perldoc perllol


Moreover, you can also pick up Intermediate Perl by the same Authors who wrote Learning Perl


(This post was edited by 2teez on Jul 28, 2013, 12:34 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives