Coder Social home page Coder Social logo

buaa_compile_2019's Introduction

BUAA_Compile_2019

Codes for course design of BUAA Compiler 2019 (the highest challenge). Implemented with C++.

Author: Zinuo You

Course Final Grade: 96

Guide Book: Guide Book (Chinese)

Run

  • Compiler: Clang
  • Recommended Development Enviroment: Visual Studio 2019+.
  • Notice: Due to automatic judgement enviroment, there's not physical directories and all codes are in the same directory. If you want to view the structure of the codes, I strongly recommend you to clone it and use Visual Studio open .vcxproj file (virtual directories will show).
  • Input file: testfile.txt
  • Output files:
    1. output.txt: objects codes (can run on MARS)
    2. log files: log information when running in different steps.(errors, warnings, data flow graph, reference count and etc.)

Features

  • Source Code: Persuade C (similar to C, but simplified for teaching purpose.)
  • Object Code: MIPS-32
  • Pluggable Compiling Optimization
    1. inline optimization.
    2. assignment spread optimizing.
    3. dead code optimization.
    4. register allocation (global registers: reference count, local registers: FIFO with active analysis on data flow graph).
    5. seek optimization for object codes generation. (branch, mod and etc.)
    6. Final Optimization Race: 6/306, please see Optimization Report(Chinese) for details.

Branches

  • unit2 : Implement lexical parser on FSM.
  • unit3 : Implement grammer parser with recursive descent method (from top to bottom). Use peeking (next one/two) to make sure no recall.
  • unit4 : Implement error analysis of grammer errors and semantic errors.
  • unit5 : Implement object codes generation of generating middle codes and generating MIPS codes. Object codes can run on MARS but do not have any optimization with only three registers being used, so you can almost regard it as a stack symbol machine.
  • unit6 : Current version, see "features" for details.

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.