Re: PHP parsing script



On 29.04.2007 15:39 Sebosac wrote:
Hi,

i need to write a php script parser but i don't really succes to wrote
one and i finaly i don't know how do this !

Well, to write a php parser you first need a parser generator like yacc or bison. I'm not aware of any one that is able to generate php code, but try googling "php parser generator". When you get the parser, write the php grammar for it (or adapt zend_language_parser.y from php sources). Fill your grammar with appropriate actions and run the generator. That's basically all about this.


--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
.



Relevant Pages

  • Re: [FYI] Quercus/PHP ohne Resin
    ... PHP aber auch... ... ArrayIndexOutOfBoundsExceptions irgendwie tief im Interpreter, ... Verwendung von selbstgeschriebenen byte-Strings vorbei. ... warscheinlich auch in einem selbstgeschriebenen Parser resultieren. ...
    (de.comp.lang.java)
  • Re: [PHP] Re: Newbie question about
    ... While I've been using php for more than a little while now, ... Stepping out from PHP and in again is handled by the lexical scanner, it doesn't even reach the parser level so, for all effects, the PHP interpreter is basically frozen at the point before the ?> ... The reason for this is that generating a single string either from variable interpolation as in the second case or by concatenating the arguments, as in the third, requires a lot of memory handling for the strings and its intermediate and final results. ... Finally, the first option is the fastest just as a C++ iostream or a Java StringBuffer are faster than plain strings: since you know you will only append to the end of them, the characters echoed go into a much more efficient character buffer instead of a more complex string which has to be available for all sorts of string operations. ...
    (php.general)
  • Re: eval() is insecure, but what are the alternatives?
    ... I agree with the parser suggestion and have also ... previously searched for an expression parser, as this would be the best ... to keep it a native php solution. ...
    (comp.lang.php)
  • Re: Firefox not read php
    ... www.example.net/somefile.php, then there is a problem at the serverside, ... If you don't get a proper output when you read a local file as ... No, you shouldn't have a php parser in a browser, php is meant as server side ...
    (alt.linux)