Final Report

Final Report

PLT Fall 2018 Shoo The Final Report Claire Adams (cba2126) Samurdha Jayasinghe (sj2564) Cindy Le (xl2738) Crystal Ren (cr2833) December 18, 2018 Contents 1 Introduction 9 1.1 White Paper . .9 1.1.1 Powerful . .9 1.1.2 Convenient . .9 1.1.3 Portable . .9 2 Tutorial 9 2.1 Environment Setup . .9 2.2 Compilation Guide . 10 2.3 Language Tutorial . 11 3 Language Manual 11 3.1 Comments and Whitespace . 11 3.1.1 Single-line Comments . 11 3.1.2 Multi-line Comments . 11 3.1.3 Whitespace . 12 3.2 Data Types . 12 3.2.1 Primitive Data Types . 12 3.2.2 The Void Keyword . 12 3.3 Variables . 13 3.3.1 Variable Naming . 13 3.3.2 Scope of Variables . 13 3.3.3 Variable Declarations . 13 3.3.4 Variable Assignment . 13 3.4 Arrays . 14 3.4.1 Declaring Arrays . 14 3.4.2 Defining Arrays . 14 3.4.3 Arrays in Arrays . 15 3.4.4 Accessing Array Elements . 16 3.5 Structs . 16 3.5.1 Declaring Structs . 16 3.5.2 Variables of Type Struct . 17 3.5.3 Defining Variables of Type Struct . 18 3.5.4 Dot Operator . 18 3.5.5 Destructuring Assignment of Structs . 18 3.6 Operators . 19 3.6.1 Precedence and Associativity . 19 3.6.2 Assignment Operator . 20 3.6.3 Arithmetic Operators . 20 3.6.4 Logical Operators . 21 3.6.5 Increment and Decrement Operators . 21 3.7 Statements . 21 3.7.1 Simple Statements . 21 3.7.2 The For Loops . 21 1 3.7.3 The While Loops . 22 3.7.4 The If Statements . 23 3.8 Functions . 23 3.8.1 Function Declarations . 23 3.8.2 Function Definitions . 24 3.8.3 Calling Functions . 26 3.9 Built-in Functions . 26 3.9.1 print . 26 3.9.2 println . 26 3.9.3 str of bool................................. 26 3.9.4 str of float . 26 3.9.5 str of int.................................. 27 3.9.6 string concat . 27 3.9.7 string equals . 27 3.9.8 int of float . 27 3.9.9 int of str ................................. 27 3.9.10 float of int................................. 27 3.9.11 scan line . 27 3.9.12 scan char.................................. 28 3.9.13 die . 28 3.9.14 exit success . 28 3.9.15 rand autoseed . 28 3.9.16 rand afterseed . 28 4 Project Plan 28 4.1 Planning, Specification, Development, and Testing . 28 4.2 Style Guide . 29 4.3 Project Timeline . 30 4.3.1 Planned Timeline . 30 4.3.2 Actual Project Timeline . 31 4.4 Team Roles and Responsibilities . 31 4.5 Software Development Environment . 32 4.6 Project Log . 32 5 Language Evolution 32 5.1 Original Thoughts . 33 5.2 Narrowing Down the Scope . 33 5.3 Design Choices for Syntax . 33 5.4 Design Choices for Functionality . 34 5.5 Design Summary . 34 6 Translator Architecture 35 6.1 Lexer . 35 6.2 Parser . 35 6.3 Semantic Checking . 35 6.4 First Class Function Lifter . 36 2 6.5 Code Generation . 36 6.6 C Libraries . 37 7 Test Plan 37 7.1 Unit Testing . 37 7.2 Integration Tests . 38 7.2.1 Test Automation and Scripts . 38 7.3 Example Test Programs . 39 7.4 Division of Labor for Testing . 61 8 Conclusions and Lessons Learned 61 8.1 Claire . 61 8.2 Cindy . 61 8.3 Sam . 61 8.4 Crystal . 62 9 Acknowledgements 62 10 Appendix 62 10.1 Project Log . 62 10.2 shoo.ml . 127 10.3 scanner.mll . 128 10.4 ast.ml . 129 10.5 parser.mly . 134 10.6 sast.ml . 139 10.7 semant.ml . 143 10.8 lift.ml . 154 10.9 codegen.ml . 160 10.10 builtins.c . 172 10.11 Makefile . 175 10.12 testall.sh . ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    263 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