PHP中类似Flex/Bison的功能 [英] Flex/Bison-like functionality within PHP

查看:91
本文介绍了PHP中类似Flex/Bison的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种在PHP中获得Flex/Bison(或Lex/Yacc等)支持的方法.具体来说,我正在Web UI中实现布尔查询解析器,宁愿将所有操作都保留在PHP内部(而不是调用C解析器或将其传递给Python等).

I'm looking for a way to get Flex/Bison (or Lex/Yacc, et. al.) support in PHP. Specifically, I'm implementing a boolean query parser in a web UI and would rather keep all operations inside of PHP (as opposed to calling a C parser, or passing things off to Python, etc.).

推荐答案

LIME 解析器PHP生成器:

LIME Parser Generator for PHP:

完整的LALR(1)解析器生成器和 引擎(例如BISON或YACC),但是 全部用PHP完成,输入语法 更容易,更易于维护.写 您在PHP中的操作.生成PHP 输出代码.驱动解析器 PHP.想讲一种语言吗?

Complete LALR(1) parser generator and engine (like BISON or YACC) but it's all done in PHP, and the input grammar is easier and more maintainable. Write your actions in PHP. Generate PHP output code. Drive your parser with PHP. Wanna make a language?


更新:


update:

自从我撰写以上内容之后,我发现这里还介绍了一些其他用于生成解析器的工具:

Since I wrote the above, I see that there are some other tools for parser generation, announced here:

http://wezfurlong.org/blog/2006/nov/parser-and-lexer-generators-for-php/

不确定在2014年现在是否可以更好地进行维护,但是我知道Wez Furlong是他最初的PDO开发人员,并且他是一个非常优秀的开发人员.

Not sure if these are any better maintained now in 2014, but I know Wez Furlong, he was the original developer of PDO, and he is a very good developer.

这篇关于PHP中类似Flex/Bison的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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