The MRRoboto Language Jason Kopylec Hema Krishnan Adam Marczyk Programming Languages Spring 2004 The Inspiration In most operating systems writing programs that interact with other programs is difficult n Graphical user interfaces are designed for humans not programs n There are many conceivable situations for which it would be nice to be able to control other programs programmatically n Solution Control the keyboard and the mouse through software n The Concept The Macro Record Robot Language MRRoboto for short allows programmers to automate control of the keyboard and the mouse through simple batch programs n The syntax is Java like but simplified so that scripts can be written quickly n A good way to teach beginning programmers basic concepts such as flow control and modularization n The Execution The ANTLR parser generator was used to create a grammar file that translates MRRoboto scripts into human readable Java source code which can then be compiled and run n Translation consists of three steps lexical analysis syntax tree generation and a treewalking algorithm that performs semantic analysis and generates the code n Some Examples a simple hello world program mouseMove 10 10 click mouseMove 50 10 click type notepad press ENTER type Hello World More Examples delays and flow control int a a 3 wait 60000 60 seconds if a 10 moveAndDoubleClick 20 20 else while a 5 moveAndClick 50 50 end end The Main Block and Procedures string b b foo doType b procedure doType string msg type msg end Error Detection and Recovery Code that violates the grammar rules bad token incorrect syntax etc will be detected by ANTLR during initial lexical analysis and parsing n Code that contains semantic errors undefined symbol type mismatch missing return statement etc will be detected by the semantic analyzer during the final stage of translation n Future Directions We had relatively little time to implement computer vision functionality other than some simple pixel color detection so the ability of MRRoboto programs to actually interact with the screen is fairly limited n More sophisticated means of interaction perhaps including automatic detection of system native windowing components seems to be a likely place for future expansion n
View Full Document
Unlocking...