Lex和Yacc在PHP中 [英] Lex and Yacc in PHP

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

问题描述

在PHP中是否有Lex和Yacc的实现?

Is there an implementation of Lex and Yacc in PHP?

如果没有,那么谁能建议一个词法分析器和解析器生成器(即Lex和Yacc之类的东西)来创建PHP代码.我不太担心生成的解析器的性能.

If not, can anyone suggest a lexical analyser and parser generator (ie, anything like Lex and Yacc) that will create PHP code. I'm not too worried about the performance of the resulting parser.

我厌倦了使用正则表达式解析真正不应该用正则表达式解析的内容...

I am sick of using regex to parse things that really shouldn't be parsed with regex...

推荐答案

有JLexPHP:我还没有使用过它,但是它是这样的: http://pear.php.net/package/PHP_ParserGenerator ,它根据 Lemon 语法创建一个PHP解析器.不过,该项目似乎处于非活动状态.

I've not used it, but there's this: http://pear.php.net/package/PHP_ParserGenerator , which creates a PHP Parser from a Lemon grammar. The project seems to be inactive though.

我还找到了这个项目: http://code.google.com/p/antlrphpruntime/,它使用 Antlr .再次处于非活动状态.

I also found this project: http://code.google.com/p/antlrphpruntime/ , which uses Antlr. Again inactive though.

这篇关于Lex和Yacc在PHP中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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