cfggenerator.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:symautomata 作者: GeorgeArgyros 项目源码 文件源码
def _clean_terminals(self):
        """
        Because of the optimization, there are some non existing terminals
        on the generated list. Remove them by checking for terms in form Ax,x
        """
        new_terminals = []
        for term in self.grammar.grammar_terminals:
            x_term = term.rfind('@')
            y_term = term.rfind('A')
            if y_term > x_term:
                x_term = y_term
            ids = term[x_term + 1:].split(',')
            if len(ids) < 2:
                """It'input_string a normal terminal, not a state"""
                new_terminals.append(term)
        self.grammar.grammar_terminals = new_terminals
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号