PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.
-
Upload
samson-moore -
Category
Documents
-
view
215 -
download
0
Transcript of PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.
![Page 1: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/1.jpg)
PLT Final Project---COLOGO
Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang
![Page 2: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/2.jpg)
Overview of COLOGO
Columbia LOGOMotivation: For educational use
1. an effective programming language for drawing 2D graphics2. designed in spirit of low threshold, easily implemented.
![Page 3: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/3.jpg)
Function Feature
Euclidean PicturesCreating FunctionsRecursiveIridescentSimple Data Structure such as Array.Support direct HTML and Javascript Output
![Page 4: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/4.jpg)
COLOGO VS. LOGO
ColorfulCompile togetherNo list
![Page 5: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/5.jpg)
Language Tutorial
![Page 6: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/6.jpg)
Some examples of our program
• Fibonacci
• Recursive
![Page 7: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/7.jpg)
Some examples of our program
• Olympic Rings (faked)
![Page 8: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/8.jpg)
• Rainbow
Some examples of our program
![Page 9: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/9.jpg)
Language Tutorial
• Variable Declaration
• Int a,b;
• Bool c;
• foo d; (:foo is a object:)
• Int e[10]; (:array:)
![Page 10: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/10.jpg)
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:)
![Page 11: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/11.jpg)
Language Tutorial
• Loop
• Loop(10) { a = a + 1; }
• Loop(10) { a = a + 1; Break; }
• Loop(10) { a = a + 1; Goon;}
![Page 12: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/12.jpg)
Language Tutorial
• Condition
• If (c) { a = b; } End
• If (c) { a = b; } Else { b = a; } End
![Page 13: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/13.jpg)
Language Tutorial
• Jump
• If (c) { a = b; } End
• If (c) { a = b; } Else { b = a; } End
![Page 14: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/14.jpg)
Language Tutorial
• Draw
•Move Forward: FD 10;
•Move Backward: BK 10;
• Turn Left: LF 90;
• Turn Right: RT 90;
![Page 15: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/15.jpg)
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]
![Page 16: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/16.jpg)
Language Tutorial
• Function
• Declaration:
• Func testfunc(int n) : int { Return n;}
• Call:
• a = testfunc(b);
![Page 17: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/17.jpg)
Language Tutorial
• Object
• Definition:
• Obj foo { int bar; int baz;}
• Declaration:
• foo d;
• Reference: dot operator
• d.bar = a; b = d.baz;
![Page 18: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/18.jpg)
Implementation
![Page 19: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/19.jpg)
Layout
![Page 20: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/20.jpg)
Flow
Ast: Abstract Syntax Tree Types Definition
One Rule -> One Type Constructor
![Page 21: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/21.jpg)
Flow
Scanner: Generate Tokens
Parser: Generate ASTUse Type Constructor Defined in AST
![Page 22: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/22.jpg)
FlowScanner: Generate Tokens
Parser: Generate AST Use Type Constructor Defined in AST
Basic Error Recovery
![Page 23: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/23.jpg)
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
![Page 24: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/24.jpg)
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
![Page 25: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/25.jpg)
Flow
Generator: Traversal of AST
Generate JS Code in HTML5 file
Draw Statement
Array in Obj
![Page 26: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/26.jpg)
Flow
![Page 27: PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.](https://reader036.fdocuments.in/reader036/viewer/2022062722/56649f355503460f94c53a79/html5/thumbnails/27.jpg)
•SUMMARY
•Further to develop
•Lessons learned