独立的语法和解析器的PHP [英] standalone grammar and parser for php

查看:171
本文介绍了独立的语法和解析器的PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在找一个现成的语法和解析器PHP(至少5.2),最好的实用工具/库,可以解析PHP code为可读AST,例如XML。解析器本身并没有在PHP写入,源语言没有太大关系。

i'm looking for a ready-made grammar and parser for php (at least 5.2), ideally an utility/library that can parse php code into a readable AST, e.g. xml. The parser itself doesn't have to be written in php, the source language doesn't matter much.

推荐答案

要回答我的问题我已经成功地编译 PHC在我的OSX箱的,解析器部分似乎运作良好。

To answer my own question I've managed to compile phc on my OSX box, the parser part seems to work well

 phc --dump-xml=ast foo.php > bar.xml

创建了AST的XML重新presentation。

creates an xml representation of the AST.

这篇关于独立的语法和解析器的PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆