能否调车场算法解析POSIX正则EX pressions? [英] Can the shunting yard algorithm parse POSIX regular expressions?

查看:171
本文介绍了能否调车场算法解析POSIX正则EX pressions?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

乍一看,该调车场算法似乎适用于POSIX正EX pression解析,但因为我没有以书面形式解析器多少经验(或理论背景),我想跳的,写的东西只拿到一半卡住之前问左右。

At first glance, the shunting yard algorithm seems applicable to POSIX regular expression parsing, but since I don't have much experience (or theoretical background) in writing parsers, I'd like to ask SO before jumping in and writing something only to get stuck halfway.

也许这个问题的一个更复杂的版本是:什么是分流码算法可以应用到这类问题的一个很好的正式说明

Perhaps a more sophisticated version of the question is: What is a good formal statement of the class of problems the shunting yard algorithm can be applied to?

澄清:这个问题是您是否可以解析使用分流算法的基本原理,你不是是否可以使用常规的EX pressions实现POSIX重新语法到抽象语法树分流算法。对不起,我是不够明确,说明他们从一开始!

Clarification: This question is about whether you can parse POSIX re syntax into an abstract syntax tree using the basic principles of the shunting algorithm, not whether you can use regular expressions to implement the shunting algorithm. Sorry I wasn't clear enough stating that to begin with!

推荐答案

我相当肯定可以。如果你看看亨利Spencer的正前pression包:

I'm fairly sure it can. If you look at Henry Spencer's regular expression package:

regexp.shar.Z

这是基础,Perl的正则EX pressions,你会发现,他所描述的节目作为是铁路正常的形式。

which was the basis for Perl's regular expressions, you will notice that he describes the program as being in "railroad normal form".

这篇关于能否调车场算法解析POSIX正则EX pressions?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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