Download presentation
Presentation is loading. Please wait.
Published bySamson Moore Modified over 9 years ago
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
COLOGO VS. 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
Rainbow Some examples of our program
9
Language Tutorial Variable Declaration Int a,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: Func testfunc(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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.