简体   繁体   English

用于先计算和后计算的工具/应用程序

[英]Tool/Application to calculate first and follow sets

I am currently working on a parser and it seems that I have made a few mistakes druing the follow set calculation.我目前正在研究一个解析器,似乎我在跟随集计算中犯了一些错误。 So I was wondering if someone know a good tool to calculate follow and first sets so I could skip/reevaluate this error prone part of the parser construction.所以我想知道是否有人知道一个很好的工具来计算跟随和第一组,这样我就可以跳过/重新评估解析器构造中这个容易出错的部分。

Take a look at http://hackingoff.com/compilers/predict-first-follow-set看看http://hackingoff.com/compilers/predict-first-follow-set

It's an awesome tool to compute first and follow sets in a grammar.这是一个很棒的工具,可以先计算并遵循语法中的集合。 also, you can check your answer with this visualization tools:此外,您可以使用此可视化工具检查您的答案:

http://smlweb.cpsc.ucalgary.ca/start.html http://smlweb.cpsc.ucalgary.ca/start.html

通过将我的第一个/后续集与此网络应用程序生成的集进行比较,我发现了我的错误

Most parser generators that I've encountered don't have obvious means to dump this information, let alone dump it in a readable way.我遇到的大多数解析器生成器都没有明显的方法来转储这些信息,更不用说以可读的方式转储它了。 (I built one that does, for the reason you are suggesting, but it isn't available by itself and I doubt you want the rest of the baggage). (出于您建议的原因,我构建了一个这样做的,但它本身不可用,我怀疑您是否想要其余的行李)。

If your parser definition doesn't work, you mostly don't need to know these things to debug it.如果您的解析器定义不起作用,您通常不需要知道这些东西来调试它。 Staring at the rules amazingly enough helps;惊人地盯着规则有帮助; it also helps to build the two smallest grammar instances you can think of, one being something you expect to be accepted, and the other being a slight variant that should be rejected.它还有助于构建您能想到的两个最小的语法实例,一个是您希望被接受的东西,另一个是应该拒绝的轻微变体。

In spite of having a parser generator that will dump this information, I rarely resort to using it to debug grammars, and I've built 20-30 pretty big grammars with it.尽管有一个解析器生成器可以转储这些信息,但我很少使用它来调试语法,而且我已经用它构建了 20-30 个相当大的语法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM