摘要: 编译原理,LL1算法,基于python实现 # LL(1)文法扫描器: # 根据现有的文法 # 创建first集 # 创建follow集 # 创建预测分析表 # 对输入的字符进行分析 flag = 0 # first或者follow是否变化的标志 step = 0 # 分析过程每一步 def add 阅读全文
posted @ 2022-07-02 11:56 晒太阳,灭bug 阅读(430) 评论(0) 推荐(0) 编辑
摘要: 递归下降法的python实现 # 递归下降法 def test(): global index return test_input[index] def E(): T() _E() def _E(): global index if test() == '+': index += 1 T() _E( 阅读全文
posted @ 2022-07-02 11:55 晒太阳,灭bug 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 为了不使用破旧的vc++6.0,我去网上找到了python可以调用的库 PLY库,官方网站是http://www.dabeaz.com/ply/ply.html 同时也参考了文章:https://blog.csdn.net/chosen0ne/article/details/8077880 通过PL 阅读全文
posted @ 2022-07-02 11:54 晒太阳,灭bug 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 上学的时候,老师让写实验。我看到这破旧的vc++6.0,心生厌恶,于是申请用python写。 老师同意了,那么就有了我的代码。 我分享出来,希望供大家参考。 词法分析的python代码参考了C语言版本的代码 : https://www.cnblogs.com/zyrblog/p/6885922.ht 阅读全文
posted @ 2022-07-02 11:49 晒太阳,灭bug 阅读(75) 评论(0) 推荐(0) 编辑