1

Can any one give me some idea about how does a php file get parsed? I'm actually looking for the finite state machine structure for the parser. If anyone has any idea please share.

ain
  • 21,939
  • 3
  • 50
  • 72
Dolphin
  • 343
  • 3
  • 9

2 Answers2

2

PHP uses bison/yacc to generate a parser. Have a look at the grammar here: http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_language_parser.y?view=markup

halfdan
  • 32,443
  • 8
  • 76
  • 85
1

You better use an existing one:

Any decent PHP parser written in PHP?

Community
  • 1
  • 1
Karoly Horvath
  • 91,854
  • 11
  • 113
  • 173