Dice “Java, but worse” David Watkins Khaled Atef Emily Chen Phil Schiffrin Project Manager Testing Wizard Language Guru System Hacker
1 Introduction Dice in a nutshell
LET’S REVIEW SOME CONCEPTS LLVM Object-Oriented Multi-Level Inheritance Our backend compiled to The ability to define A Person object can have LL IR code. This allows for objects, define their as many children as it cross-platform code methods, and define wants, but only one without recompiling the private/public scope parent original source Arrays Useful Standard Library Useful Error Messages Single dimensional arrays File, String, and Integer Every single error that the as well as arrays defined classes defined as closely compiler encounters will with expressions placed to the Java Library as print a rich error message in the elements possible for the user
2 Project Management Timeline Dice is a big language
5921 Lines of Code Our compiler was a huge undertaking 109 Issues Closed 526 reduce/reduce conflicts resolved 47 Custom Emojis Total success!
3 rd Party Software Solutions Slack Github Ubuntu The bread and The best solution for Utilizing an Ubuntu butter for group our version control VM stack gave us communications. needs. Branches much needed were key. consistency.
Git History
3 So how do you speak it? Dice is a BIG language
Syntax Basics Comments Operators Arrays
Syntax Statements Loops if-else/else-if
Syntax Objects Objects Inheritance File IO
4 How it’s made Not featured on Discovery Channel
Implementation Design Input.dice • Scanner Tokens • Parser AST • Analyzer • Scan and Parse Includes SAST • Codegen Out.ll
Implementation AST program includes classes fields constructors methods statements expressions
Implementation SAST program functions structures Main Reserved statements expressions Fields Func_decls*
Implementation Structs with Inheritance Nerd Struct Techer Struct Stephen Struct int key int key int key bool isNerd bool isNerd bool isNerd bool isTecher bool isTecher bool isTeacher
Implementation Virtual Function Table Class Nerd Techer Stephen Indexes Function isNerd:Nerd isNerd:Nerd isNerd:Stephen Indexes isTeacher:Stephen • Lookup the void* using function index and class index • Casts function pointer to correct function pointer • Makes function calls with original parameters
Implementation Standard Library String Class Integer Class File Class Includes methods Get the string Open, close, read, for comparison of representation of and write to a file strings and integers obtaining the length
Implementation Compiler Flags Pretty Printing SAST/AST in JSON Tokens
5 TDD Test driven development saves lives
Testing Regression Suite TDD Testing Invalid Code From day 1 we made our Making sure our compiler is regression suite. We started not only correct, but also with MicroC, then added a finds user errors test for each bug/feature we could think of
Testing Regression Suite
Time to demo! Hope you like zoos with small dogs
Recommend
More recommend