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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
PHP Parser


New User

Jul 28, 2013, 7:10 AM

Post #1 of 4 (1329 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)

Veteran / Moderator

Jul 28, 2013, 7:24 AM

Post #2 of 4 (1322 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.

Veteran / Moderator

Jul 28, 2013, 10:53 AM

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

You might also take a look at Damian Conway's Parse::RecDescent package:


Jul 28, 2013, 12:32 PM

Post #4 of 4 (1314 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:

 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