GithubHelp home page GithubHelp logo

rev0cat / compiler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lrl52/compiler

0.0 0.0 0.0 1.09 MB

电子科技大学(UESTC)编译技术实验

C++ 1.00% C 91.34% Makefile 0.24% Yacc 4.33% Lex 3.08%

compiler's Introduction

编译原理实验 Lab2——递归下降分析法

笔者的程序不会回溯,使用了一点人类智慧来预测接下来应该进入的分支,保证每次进入的分支都是正确的,因此可能不完全是递归下降分析法

实验环境:Ubuntu-22.04,请提前安装好 flex, gcc, g++, make 构建工具

程序的输出严格遵循 clang 生成的语法树(ast),略去了部分 sysy 文法中没有的信息,例如 ImplicitCastExpr。clang 生成 xxx.c 的语法树(ast)的参考命令:

clang  -fsyntax-only -Xclang -ast-dump xxx.c

项目构建:

make

构建后会产生 main(递归下降分析程序), scan(词法分析器,可用于 Debug )和 test (测试脚本程序)

程序测试:

./test

所有测试结果会存放在 ./test_cases_output

注:确保输入用例的词数不超过 MAXN(默认为 100005,定义在 main.c中 ),文法符合 sysy.y 中的产生式

递归下降分析法

compiler's People

Contributors

lrl52 avatar

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.