GWAPL - Columbia CS

GWAPL
Samina Rahman
Ilia Vovsha
Mehmet Yonac
What is GWAPL?
• GWAP is a slang term for money (and other vulgar
words if you believe www.urbandictionary.com)
• Actually, GWAP is an acronym for ‘Game With a
Purpose’
• Introduced by Luis von Ahn of CMU in 2005
• Idea: humans spend billions of hours playing
(useless) computer games such as solitaire and
minesweeper. Can we get them to do something
useful instead?
What is GWAPL?
• Problem: No! people will always find ways to waste
their time
• Solution: design computer games that encourage
users to produce useful computation as a side effect
(e.g. training datasets for computer systems)
• Hence the GWAP
• And hence the GWAPL, a high-level, scripting
language that enables users to design and test
GWAPs with relative ease
Why GWAPL?
• Most GWAPs have several common components
• GWAPL supports these basic components as built-in
types:





Avatar (player)
World (game)
Ruleset (game rules)
Pool (player matching mechanism)
Dataset (input/output data)
• Essentially a convenient platform to develop GWAP
prototypes
• Datasets are unique to GWAPs
GWAPL Syntax
• Derived from C and Java
– Primitives and control statements are similar
• Definition & Action Syntax
– Definition: memory allocated instantly
– Example
avatar a1; //initialize with default attribute values
avatar a2 { //user-specified attribute values
name = "Mary";
score = 0;
skill = MASTER;
};
pool p1;
//define default game pool
GWAPL Syntax Cont’d
– Actions
– Act on “objects,” such as avatars
– Enable communication among objects
– Example
p1.add(a1); //add players to pool
p1.add(a2); //enables players to play one another
p1.play()
//play a round according to game rules
a2.updateScore(); //update score according to game rules
Compiler Layout
GWAPL
Source
Error
Checking /
Reporting
Code
Translation
Libraries (C)
Lexical
Analysis:
Lex
Syntactic /
Code Gen.
Yacc
Token
Stream
Symbol Table
Backend:
GCC
IR
( in C )
Mach.
Lang.
Code Generation
• Pre-order tree walk
• CFG is important
– Language could be expressed in LR(1)!
– So far, only 1 shift/reduce conflict
– Rules may need to be rewritten and tested as
features expand
GWAPL Libraries
•
•
•
•
Included by default in the IR
C libraries can also be used
Programmer can also include own C libraries
High scalability by modifying GWAPL libraries
Testing
•
•
•
•
•
•
Phase 1: Lexer
Phase 2: Dummy Grammar
Phase 3: Symbol Table Data Structure
Phase 4: C-like Code Generation
Phase 5: Fundamental GWAPL Features
Phase 6: Intermediate GWAPL Features
• Changes to Grammar & Libraries at Each
Phase
Conclusions
• Before you decide to create your own
language, ascertain that it isn’t easier to add
libraries to an existing one
• Be modest. Start small.
• Human computation is a young but fast
growing field, you’ll hear more about it in the
near future
• No more solitaire! We now play ESP and
Verbosity on www.gwap.com