PLT Final Project COLOGO Lixing Dong Zhou Ma Chao Song Siyuan Lu Dongyang Jiang Overview of COLOGO Columbia LOGO Motivation For educational use 1 an effective programming language for drawing 2D graphics 2 designed in spirit of low threshold easily implemented Function Feature Euclidean Pictures Creating Functions Recursive Iridescent Simple Data Structure such as Array Support direct HTML and Javascript Output COLOGO VS LOGO Colorful Compile together No list Language Tutorial Some examples of our program Fibonacci Recursive Some examples of our program Olympic Rings faked Some examples of our program Rainbow Language Tutorial Variable Declaration Int a b Bool c foo d foo is a object Int e 10 array Language Tutorial Expression Assignment a 1 c True Arithmetic Expression a b a Comparison Expression c a b Logical Expression c a b Not c Function call a testfunc b Comment This is a comment Language Tutorial Loop Loop 10 a a 1 Loop 10 a a 1 Break Loop 10 a a 1 Goon Language Tutorial Condition If c a b End If c a b Else b a End Language Tutorial Jump If c a b End If c a b Else b a End Language Tutorial Draw Move Forward FD 10 Move Backward BK 10 Turn Left LF 90 Turn Right RT 90 Language Tutorial Draw Reset position RESET Clear Screen CLS Pen Operation PU PD PF Line Width WD 10 Set Line Color RGB 255 a e 2 Language Tutorial Function Declaration Func testfunc int n int Return n Call a testfunc b Language Tutorial Object Definition Obj foo int bar int baz Declaration foo d Reference dot operator d bar a b d baz Implementation Layout Flow Ast Abstract Syntax Tree Types Definition One Rule One Type Constructor Flow Scanner Generate Tokens Parser Generate AST Use Type Constructor Defined in AST Flow Scanner Generate Tokens Parser Generate AST Use Type Constructor Defined in AST Basic Error Recovery Flow Semantic Traversal of AST Checking Variables Function Definitions Type Matching etc Generator Traversal of AST Generate JS code in HTML file Printer Traverse and print the AST Flow Semantic Traversal of AST Checking Variables Redefinition Type Matching Array Object Function Matching Parameter Count Argument Type Return Type Definition Scope Stack faked by List Small Features infinite loop Flow Generator Traversal of AST Generate JS Code in HTML5 file Draw Statement Array in Obj Flow SUMMARY Further to develop Lessons learned
View Full Document
Unlocking...