Giter Site home page Giter Site logo

dragon-front's Introduction

Dragon-Front

THE COMMENT FOR A COMPLETE FRONT END OF THE DRAGON BOOK
2015 SYSU COMPILER PROJECT 4

##文件结构简介

  • bin: 由eclipse自动生成的可执行文件
  • doc: javadoc生成的注解文档,使用命令:javadoc inter/*.java lexer/*.java main/*.java parser/*.java symbols/*.java -d ../doc -encoding UTF-8 -charset UTF-8
  • ref: 其中CompilerAppendixA.pdf是龙书附录A,而documents.pdf则是编译器源码的分析与注解
  • src: 完整编译器前端的源码,含注释
  • uml: 编译器前端类的类图,包含jpg档和uxf档,其中uxf档请使用UMLet打开

##编译器识别语言的文法

program -> block
block -> { decls stmts }
decls -> decl decls | epsilon
decl -> type id
type -> basic dims
dims -> [ num ] dims | epsilon
stmts -> stmt stmts | epsilon

stmt -> ;
      | if ( bool ) stmt 
      | if ( bool ) stmt else stmt
      | while ( bool ) stmt
      | do stmt while ( bool ) ;
      | break ;
      | block
      | assign
assign -> id offset = bool ;
offset -> [ bool ] offset | epsilon

bool -> join | join || bool
join -> equality | equality && join
equality -> rel | rel == equality | rel != equality
rel -> expr 
     | expr < expr | expr <= expr 
     | expr >= expr | expr > expr
expr -> term | term + expr | term - expr
term -> unary | unary * term | unary / term
unary -> - unary | ! unary | factor
factor -> ( bool ) | num | real | true | false | id offset

dragon-front's People

Contributors

chakpongchung avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

dragon-front's Issues

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.