The Tiger Compiler Project Edition January 22, 2016

The Tiger Compiler Project Edition January 22, 2016

The Tiger Compiler Project Edition January 22, 2016 Akim Demaille, Roland Levillain and Etienne Renault This document presents the EPITA version of the Tiger project. This revision, , was last updated January 22, 2016. Copyright c 2000-2009, 2011-2012 Akim Demaille. Copyright c 2005-2014 Roland Levillain. Copyright c 2014-2016 Akim Demaille, Etienne Renault. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover texts and with the no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License." i Table of Contents 1 Introduction ::::::::::::::::::::::::::::::::::::::::::::::: 3 1.1 How to Read this Document ::::::::::::::::::::::::::::::::::::::::::::::::: 3 1.2 Why the Tiger Project::::::::::::::::::::::::::::::::::::::::::::::::::::::: 3 1.3 What the Tiger Project is not ::::::::::::::::::::::::::::::::::::::::::::::: 5 1.4 History :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 6 1.4.1 Fair Criticism::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 6 1.4.2 Tiger 2002 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 7 1.4.3 Tiger 2003 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 8 1.4.4 Tiger 2004 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 9 1.4.5 Tiger 2005::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 10 1.4.6 Tiger 2006::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 12 1.4.7 Tiger 2005b ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 14 1.4.8 Tiger 2007::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 15 1.4.9 Tiger 2008::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 16 1.4.10 Leopard 2009 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 17 1.4.11 Tiger 2010:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 18 1.4.12 Tiger 2011:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 18 1.4.13 Tiger 2012:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 19 1.4.14 Tiger 2013:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 19 1.4.15 Tiger 2014:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 20 1.4.16 Tiger 2015:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 21 1.4.17 Tiger 2016:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 22 1.4.18 Tiger 2017:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 23 1.4.19 Tiger 2018:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 24 2 Instructions :::::::::::::::::::::::::::::::::::::::::::::: 25 2.1 Interactions :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 25 2.2 Rules of the Game:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 25 2.3 Groups ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 26 2.4 Coding Style ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 28 2.4.1 No Draft Allowed :::::::::::::::::::::::::::::::::::::::::::::::::::::: 28 2.4.2 Use of Foreign Features :::::::::::::::::::::::::::::::::::::::::::::::: 28 2.4.3 File Conventions::::::::::::::::::::::::::::::::::::::::::::::::::::::: 28 2.4.4 Name Conventions::::::::::::::::::::::::::::::::::::::::::::::::::::: 33 2.4.5 Use of C++ Features :::::::::::::::::::::::::::::::::::::::::::::::::: 35 2.4.6 Use of stl ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 39 2.4.7 Matters of Style ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 40 2.4.8 Documentation Style :::::::::::::::::::::::::::::::::::::::::::::::::: 43 2.5 Tests ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 46 2.5.1 Writing Tests :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 46 2.5.2 Generating the Test Driver :::::::::::::::::::::::::::::::::::::::::::: 46 2.6 Submission ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 47 2.7 Evaluation ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 47 2.7.1 Automated Evaluation ::::::::::::::::::::::::::::::::::::::::::::::::: 47 2.7.2 During the Examination ::::::::::::::::::::::::::::::::::::::::::::::: 48 2.7.3 Human Evaluation::::::::::::::::::::::::::::::::::::::::::::::::::::: 48 2.7.4 Marks Computation ::::::::::::::::::::::::::::::::::::::::::::::::::: 49 ii The Tiger Compiler Project Assignment 3 Source Code:::::::::::::::::::::::::::::::::::::::::::::: 51 3.1 Given Code :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 51 3.2 Project Layout ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 51 3.2.1 The Top Level ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 51 3.2.2 The build-aux Directory :::::::::::::::::::::::::::::::::::::::::::::: 52 3.2.3 The lib Directory ::::::::::::::::::::::::::::::::::::::::::::::::::::: 52 3.2.4 The lib/misc Directory ::::::::::::::::::::::::::::::::::::::::::::::: 52 3.2.5 The src Directory ::::::::::::::::::::::::::::::::::::::::::::::::::::: 55 3.2.6 The src/task Directory ::::::::::::::::::::::::::::::::::::::::::::::: 55 3.2.7 The src/parse Directory :::::::::::::::::::::::::::::::::::::::::::::: 55 3.2.8 The src/ast Directory :::::::::::::::::::::::::::::::::::::::::::::::: 55 3.2.9 The src/bind Directory ::::::::::::::::::::::::::::::::::::::::::::::: 57 3.2.10 The src/escapes Directory :::::::::::::::::::::::::::::::::::::::::: 57 3.2.11 The src/type Directory :::::::::::::::::::::::::::::::::::::::::::::: 57 3.2.12 The src/object Directory:::::::::::::::::::::::::::::::::::::::::::: 57 3.2.13 The src/overload Directory ::::::::::::::::::::::::::::::::::::::::: 58 3.2.14 The src/astclone Directory ::::::::::::::::::::::::::::::::::::::::: 58 3.2.15 The src/desugar Directory :::::::::::::::::::::::::::::::::::::::::: 58 3.2.16 The src/inlining Directory ::::::::::::::::::::::::::::::::::::::::: 58 3.2.17 The src/temp Directory :::::::::::::::::::::::::::::::::::::::::::::: 58 3.2.18 The src/tree Directory :::::::::::::::::::::::::::::::::::::::::::::: 59 3.2.19 The src/frame Directory ::::::::::::::::::::::::::::::::::::::::::::: 59 3.2.20 The src/translate Directory :::::::::::::::::::::::::::::::::::::::: 59 3.2.21 The src/canon Directory ::::::::::::::::::::::::::::::::::::::::::::: 60 3.2.22 The src/assem Directory ::::::::::::::::::::::::::::::::::::::::::::: 60 3.2.23 The src/target Directory:::::::::::::::::::::::::::::::::::::::::::: 61 3.2.24 The src/target/mips Directory:::::::::::::::::::::::::::::::::::::: 62 3.2.25 The src/target/ia32 Directory:::::::::::::::::::::::::::::::::::::: 62 3.2.26 The src/target/arm Directory ::::::::::::::::::::::::::::::::::::::: 63 3.2.27 The src/liveness Directory ::::::::::::::::::::::::::::::::::::::::: 64 3.2.28 The src/regalloc Directory ::::::::::::::::::::::::::::::::::::::::: 64 3.3 Given Test Cases ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 65 4 Compiler Stages ::::::::::::::::::::::::::::::::::::::::: 67 4.1 Stage Presentation:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 67 4.2 PTHL (TC-0), Naive Scanner and Parser ::::::::::::::::::::::::::::::::::: 68 4.2.1 PTHL Goals::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 68 4.2.2 PTHL Samples :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 68 4.2.3 PTHL Code to Write :::::::::::::::::::::::::::::::::::::::::::::::::: 74 4.2.4 PTHL faq :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 75 4.2.5 PTHL Improvements :::::::::::::::::::::::::::::::::::::::::::::::::: 75 4.3 TC-1, Scanner and Parser :::::::::::::::::::::::::::::::::::::::::::::::::: 76 4.3.1 TC-1 Goals :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 77 4.3.2 TC-1 Samples ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 77 4.3.3 TC-1 Given Code:::::::::::::::::::::::::::::::::::::::::::::::::::::: 83 4.3.4 TC-1 Code to Write ::::::::::::::::::::::::::::::::::::::::::::::::::: 83 4.3.5 TC-1 faq:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 84 4.3.6 TC-1 Improvements ::::::::::::::::::::::::::::::::::::::::::::::::::: 85 4.4 TC-2, Building the Abstract Syntax Tree ::::::::::::::::::::::::::::::::::: 85 4.4.1 TC-2 Goals :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 85 4.4.2 TC-2 Samples ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 86 4.4.2.1 TC-2 Pretty-Printing Samples::::::::::::::::::::::::::::::::::::: 86 iii 4.4.2.2 TC-2 Chunks ::::::::::::::::::::::::::::::::::::::::::::::::::::: 89 4.4.2.3 TC-2 Error Recovery ::::::::::::::::::::::::::::::::::::::::::::: 90 4.4.3 TC-2 Given Code:::::::::::::::::::::::::::::::::::::::::::::::::::::: 91 4.4.4 TC-2 Code to Write ::::::::::::::::::::::::::::::::::::::::::::::::::: 91 4.4.5 TC-2 faq:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 93 4.4.6 TC-2 Improvements ::::::::::::::::::::::::::::::::::::::::::::::::::: 95 4.5 TC-3, Bindings ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 95 4.5.1 TC-3 Goals :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 96 4.5.2 TC-3 Samples ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 96 4.5.3 TC-3 Given Code::::::::::::::::::::::::::::::::::::::::::::::::::::: 101 4.5.4 TC-3 Code to Write :::::::::::::::::::::::::::::::::::::::::::::::::: 101 4.5.5 TC-3 faq :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 102 4.5.6 TC-3 Improvements ::::::::::::::::::::::::::::::::::::::::::::::::::

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    264 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us