robot - columbia universityaho/cs4115_fall-2009/lectures/09-04-27_robot.pdfand tools • eclipse for...
TRANSCRIPT
![Page 1: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/1.jpg)
ROBOT
(we tried to make this an acronym, but couldn’t)
Eric Risser (PM)Ashish Gagneja (SI)
Soonhac Hong (V&T)Aurelien Serandour (SA)
Mengu Sukan (LG)
![Page 2: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/2.jpg)
Target Audience• The novice
–Knows very little math
–Knows no formal programming
–Knows how to turn on a computer?
(NOT YOU!!!)
![Page 3: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/3.jpg)
Motivation• Programming is hard
• Programming is tedious/boring
• Robots are cool
• Everybody likes (video) games
![Page 4: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/4.jpg)
The Solution• Make it simple
• Make it intuitive
• Make it rewarding
• And make it violent!
![Page 5: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/5.jpg)
The Game• All out robot fight to the death
–That sounds awesome! What’s the catch?
• You write an A.I. program to indirectly control your robot avatar
–Navigate terrain
–Hunt enemies
–Protect and hoard resources
![Page 6: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/6.jpg)
ROBOTIt’s more than a language
Aurelien Serandour (SA)
![Page 7: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/7.jpg)
Basic architecture
Translator(written in
Java)
ROBOTcode
(x.robot)
Javasource code
(x.java)
How can we see what the avatar does?
![Page 8: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/8.jpg)
Runtime environment
![Page 9: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/9.jpg)
Runtime environment• Editable code area
• 3D visualization
• Many functionalities:
–Auto-indentation
– (Translated) Java code viewer
–No need to restart the application to translate/run the ROBOT code!
![Page 10: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/10.jpg)
Final architecture
Translator
.robotprogram
file
.java fileJava
compiler.class file
Application
dynamic class
loader
GUIRobot class
![Page 11: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/11.jpg)
ROBOTThe gory details
Ashish Gagneja (SI)
![Page 12: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/12.jpg)
Sample ROBOT Program
! count# = 0
! think! | my_loc@ = location@ of self! |! | x# of 1th of targetLocation@... = 10! | y# of 1th of targetLocation@... = y# of my_loc@! | x# of 2th of targetLocation@... = 10! | y# of 2th of targetLocation@... = 10! | x# of 3th of targetLocation@... = x# of my_loc@! | y# of 3th of targetLocation@... = 10! | x# of 4th of targetLocation@... = x# of my_loc@! | y# of 4th of targetLocation@... = y# of my_loc@! |! | if my_loc@ != count#th of targetLocation@... then! | | move_to count#th of targetLocation@...! | +---else! | | count# = (count# + 1) rollover 4! | +---done! +---end
patrol.robot
![Page 13: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/13.jpg)
Supported types
• Number! myNumber# = 12.35
• Boolean! bool? = True
• Location! enemyLocation@ = NOWHERE@
• Enemy! enemy! = get_closest_enemy enemyList!...
• List! enemyList!... = get_enemies
• Percentage! healthValue% = 100
• Resource! myResource$ = closest_resource$
![Page 14: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/14.jpg)
Development Environmentand Tools
• Eclipse for development (with OpenGL, Swing)
• JFlex for the Lexical Analyzer
• CUP for the Parser
• SVN (Google code) for version control
• JUnit
![Page 15: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/15.jpg)
ROBOTTesting… Testing… 1, 2, 3…
Soonhac Hong (V&T)
![Page 16: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/16.jpg)
Verification & Validation! Compiler Test
! Regression and Blackbox testing for grammar consistency
! Complete Test Coverage and Traceability
count# = 0think my_loc@ = location@ of self x# of 1th of targetLoc@...=10 y# of 1th of targetLoc@...=y# of my_loc@ x# of 2th of targetLoc@...=10 y# of 2th of targetLoc@...=10 x# of 3th of targetLoc@...=x# of my_loc@ y# of 3th of targetLoc@...=10 x# of 4th of targetLoc@...=x# of my_loc@ y# of 4th of targetLoc@...=y# of my_loc@
if my_loc@ != count#th of targetLoc@... then move_to count#th of targetLoc@... 10% else count# = (count# + 1) rollover 4 doneend
User Code (Test code) Translated Code Baseline
![Page 17: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/17.jpg)
Verification & Validation (cont'd)
! Application Test
! Unit test for automation and regression
! Integration test for usability and functionality
Unit Test using JUnit Integration Test
![Page 18: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/18.jpg)
ROBOTLet’s bring it home
Mengu Sukan (LG)
![Page 19: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/19.jpg)
RecapPurpose
• Simple/intuitive
• Fun (i.e. violent)
• Rewarding (i.e. intro to programming)
![Page 20: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/20.jpg)
RecapArchitecture/Tools
• ROBOT ⇒ Java
• Translator: JFlex & CUP
• Runtime environment: Swing & OpenGL
![Page 21: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/21.jpg)
Next Steps
• Finish grammar implementation
• Testing with more complex programs
![Page 22: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/22.jpg)
Next StepsError Checking and Reporting
VS
Syntax error# Attempting error recovery# Finding recovery state on stack# Pop stack by one, state was # 10# Pop stack by one, state was # 2# Pop stack by one, state was # 0# No recovery state found on stack# Error recovery failsCouldn't repair and continue parseCan't recover from previous error(s)
Syntax error on line 21: 2: targetLocation@ 100 ----------------------^3:4: think5: | x# of targetLocation@=10 6: | y# of targetLocation@=10 7: | move_to targetLocation@ 92.5%8: +---end
![Page 23: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/23.jpg)
Things we learned
• Designing a programming language is HARD!
• Designing a SIMPLE programming language is HARDER!*
* Larry Wall’s “Waterbed Theory of Complexity”
![Page 24: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/24.jpg)
DemoBecause one animation is worth a 1,000 words...
![Page 25: ROBOT - Columbia Universityaho/cs4115_Fall-2009/lectures/09-04-27_ROBOT.pdfand Tools • Eclipse for development (with OpenGL, Swing) • JFlex for the Lexical Analyzer • CUP for](https://reader034.vdocuments.us/reader034/viewer/2022050205/5f58856744126675260d5559/html5/thumbnails/25.jpg)
Questions?Example: When can I get my hands
on this awesome game?