Is it possible to parse PHP using PEG?

The question is very simple: is it possible to parse PHP using PEG? I want to use a PEG parser to parse PHP. I ask you to advise. Thank!

+3
source share
1 answer

You can get most parser technologies to parse most languages ​​with enough effort.

Whether PEG will parse PHP effortlessly is another question.

AFAIK, PHP itself uses Bison (LALR), so I assume that PEG will most likely handle the grammar provided by the PHP distribution or something similar. And if you are going to use the PHP distribution, why not just use their provided parser?

PHP, PHP, , , -, ( ), , , langauge, - : .

+4

Source: https://habr.com/ru/post/1725109/


All Articles