Coder Social home page Coder Social logo

llandlr's People

Contributors

monimm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

llandlr's Issues

项目中潜在的一些bug

bug1、对于某些文法,求非终结符的FIRST集,空指针出错
ans:断点调试后发现,是因为在执行getFollow函数时,调用的getFirst(right);,是求串的FIRST集,在getFirst函数中,直接调用了firstSet.get(tn);,但是tn的FIRST集有可能没有事先求出,所以在前面加上 if(!firstSet.containsKey(tn) { getFirst(tn); } 即可

bug2、对于某些比较复杂一点的文法,还是会存在“求出的FOLLOW集不完整”的现象,比如如下文法:
S->I|o
I->i(E)SL
L->eS|ε
E->a|b

代码改动如下:
public String [] inputExperssion = { "S->I", "S->o", "I->i(E)SL", "L->eS", "L->~", "E->a", "E->b"};

public String strInput = "i(a)i(b)oeo$";
public Character S = 'S';
analyzeStatck.push('S');

按照您的代码,求出的FOLLOW集情况如下:
Follow S: $ e
Follow E: )
Follow I: $
Follow L: $

但是,我们知道,正确的是这样:
Follow S: $ e
Follow E: )
Follow I: $ e
Follow L: $ e

也就是说会发生不完整的现象。

ans:本人目前也不知如何解决,希望楼主看看~~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.