SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: PHP Grammar

  1. #1
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post PHP Grammar

    Hi,


    I always heard that people that uses SitePoint forums are the best PHP developers over the web... maybe you can help me then.

    The question is quite simple: I'm looking for a complete PHP Grammar.

    Researching over web... I found one: http://www.mare.ee/indrek/sablecc/php4.sablecc3.txt
    But it does not follow correctly the grammar nomenclature and it's a little bit messy.

    I'm more confortable with this kind of grammar definition (last 2 pages): http://www.dc.ufscar.br/~jose/course...20Language.pdf


    I'm interested to find more resources, to make a comparison and start my own compiler. Currently, all my compiler job is done using a hack, that parses each token returned by token_get_all and after the whole process generates a cached file, to not recompile again at each execution (smart cache technique).


    Sounds weird, but my approach stands for a PHP Grammar, that I'll build the AST using PHP to parse PHP code and compile into PHP. The usage of this compiler will be my currently package, Transparent PHP AOP (available at: http://www.phpclasses.org/browse/package/3215.html), to make it more flexible and allow on schedule things, such as programming by contract. I have a tight schedule and I do not have enough time to build my own grammar version for it.


    If possible, I'd like to listen from you of URLs or even your own notes about it.
    I do not want to use 3rd party code, so please do not refer me to existent generic compilers. I just want the PHP Grammar.


    Best regards,


    Guilherme Blanco
    MSN: guilhermeblanco#hotmail.com
    GTalk: guilhermeblanco
    São Carlos - SP/Brazil

  2. #2
    Non-Member
    Join Date
    Jul 2005
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you checked php.net?

  3. #3
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have a look at metaphp.
    Otherwise, classkit might be able to get you somewhere, although by manipulating code at runtime, rather than pre-process sources.

  4. #4
    is_empty(2); foofoonet's Avatar
    Join Date
    Mar 2006
    Posts
    1,000
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try asking this question in the Php Application Design Forum, or in the php marc listings.

    http://marc.theaimsgroup.com/?l=php-general
    Upgrading to Mysql 5? Auto-increment fields now strict
    use NULL
    Or zero or leave the field name out completely.

  5. #5
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found my answer...

    For those interested: http://www.csci.csusb.edu/dick/samples/php.syntax.html

    Thanks anyway!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •