Code Monkey home page Code Monkey logo

complier's Introduction

complier

技术报告

技术特性

词法分析

使用自动机和表驱动。

  1. 基本的关键字均可识别
  2. If,while,if_else,switch,结构体,数组,自增自减,自定义函数,布尔运算符,关系运算符,逻辑表达式,注释,函数调用等基本都能识别
  3. 有基本的错误提示

语法语义分析

递归下降分析,向前查看K个token,并生成抽象语法树。

  1. 支持基本的四则运算,基本的数据类型,赋值
  2. 支持if,while,if-else,for等语句,以及它们的嵌套使用
  3. 支持函数调用,函数定义,有参无参均可
  4. 支持结构体 struct
  5. 支持在一行进行多个变量的初始化
  6. 支持switch-case-default结构
  7. 支持数组定义,初始化,以及与变量在一行中定义

四元式

遍历语法树,得到四元式

  1. 基本的四则运算
  2. 关系运算
  3. 自定义函数调用
  4. while if for结构语句
  5. 等等

汇编生成

根据四元式,对应生成汇编代码,生成的是386intel汇编代码。

可以对四元运算,while if for语句结构以及自定义函数,生成汇编代码。

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.