什么是php好的解析器生成器? [英] What is a good parser generator for php?

查看:73
本文介绍了什么是php好的解析器生成器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要解析一种小的迷你语言",用户可以在我的网站上键入该语言.我想知道lex和jacc或antlr的对应版本对php世界有什么作用.

I need to parse a small 'mini language' which users can type on my site. I was wondering what the counterparts of lex and jacc or antlr are for the world of php.

推荐答案

我使用了用于PHP的LIME Parser生成器几年前,它已经成熟并且稳定.

I used LIME Parser generator for PHP a couple of years ago, and it was already mature and stable.

解析器生成器本身是用PHP编写的,在任何技术意义上都没有关系-因为我们仅要求生成的解析器使用PHP-但尽管如此,我仍然喜欢这个细节.这使我对用PHP编写软件感到抱歉;;)

The parser generator itself is written in PHP, which doesn't really matter in any technical sense - as we require only that the generated parser be in PHP - but I like this detail nonetheless. It makes me feel less apologetic about writing software in PHP ;-)

我应该添加:

  1. 在我写二手"的地方,说我玩过"会更准确.我还没有使用石灰编写任何生产代码.但是我没有理由不这样做.

  1. Where I wrote "used" it would be more accurate to say that I "played with". I haven't written any production code using lime, yet. But I see no reason not to do so.

lime附带的计算器示例"使用tokenize()方法,该方法与lex的功能的真正替代品相去甚远.但是,如果您需要一个真正的令牌生成器,则应该可以在前端"上使用lex将令牌提供给后端"上的lime.

The "calculator example" provided with lime uses a tokenize() method which is very far from a real substitute for the power of lex. But if you need a real tokenizer it ought to be possible to use lex on the "front end" to feed tokens to lime on the "back end".

这篇关于什么是php好的解析器生成器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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