1 / 27

PLT Final Project---COLOGO

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.

evers
Download Presentation

PLT Final Project---COLOGO

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang

  2. 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.

  3. Function Feature • Euclidean Pictures • Creating Functions • Recursive • Iridescent • Simple Data Structure such as Array. • Support direct HTML and Javascript Output

  4. COLOGOVS. LOGO • Colorful • Compile together • No list

  5. Language Tutorial

  6. Some examples of our program • Fibonacci • Recursive

  7. Some examples of our program • Olympic Rings (faked)

  8. Some examples of our program • Rainbow

  9. Language Tutorial • Variable Declaration • Inta,b; • Bool c; • foo d; (:foo is a object:) • Int e[10]; (:array:)

  10. 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:)

  11. Language Tutorial • Loop • Loop(10) { a = a + 1; } • Loop(10) { a = a + 1; Break; } • Loop(10) { a = a + 1; Goon;}

  12. Language Tutorial • Condition • If (c) { a = b; } End • If (c) { a = b; } Else { b = a; } End

  13. Language Tutorial • Jump • If (c) { a = b; } End • If (c) { a = b; } Else { b = a; } End

  14. Language Tutorial • Draw • Move Forward: FD 10; • Move Backward: BK 10; • Turn Left: LF 90; • Turn Right: RT 90;

  15. 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]

  16. Language Tutorial • Function • Declaration: • Functestfunc(int n) : int { Return n;} • Call: • a = testfunc(b);

  17. Language Tutorial • Object • Definition: • Obj foo { int bar; int baz;} • Declaration: • foo d; • Reference: dot operator • d.bar = a; b = d.baz;

  18. Implementation

  19. Layout

  20. Flow Ast:  Abstract Syntax Tree Types Definition   One Rule -> One Type Constructor

  21. Flow Scanner:  Generate Tokens Parser: Generate AST Use Type Constructor Defined in AST

  22. Flow Scanner:  Generate Tokens Parser: Generate AST  Use Type Constructor Defined in AST Basic Error Recovery

  23. 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 

  24. 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 

  25. Flow Generator: Traversal of AST Generate JS Code in HTML5 file Draw Statement Array in Obj 

  26. Flow

  27. SUMMARY • Further to develop • Lessons learned

More Related