Boardr The Racing Board Game Creation Language

advertisement
Boardr
The Racing Board Game Creation Language
The Team
Project Manager: Eric Leung
Language and Tools Guru: Shensi Ding
System Architect: Seong Jin Park
System Integrator: Jessica Wang
Tester and Validator: Nicholas Chao
Boardr: Origins
● Programming Languages and Translators course
● wanted a concept that we were all interested in
● games → board games → racing board games
Motivation
1. Winning condition provided.
2. Available for beginning programmers.
Development/Runtime Environment
● Java 1.7 - JDK 7
● ANTLR v4 - ANTLRworks
● git - Github
● Makefile
o
make game g={pathToGame}
Language
Highlights:
● Rules
● Board, Players, Die
● Library functions
● Command line game output
Hello World
Player Hello;
//creates a Player named Hello
Player World;
//creates a Player named World
Board HelloWorld = 1;
//creates a board with one block
Die = 1;
//creates a die with one side with maximum (and minimum) value of 1
Number[] i = [ 1 ]; //array of Numbers that contains the positions
Rule hello (i) { //creates a new rule, with i as a placeholder
String hello = “Hello World”;
println(hello); //prints “Hello World!” to the console
};
Here’s the parse tree!
Translator Architecture
.boardr file
BoardrTranslator
Lexer
next Token
token stream
Parser
AST
CustomListener
Java Code
Playable Game
Symbol Table
Semantic Analysis
Basic types: Board, Die, Player, Number, String, boolean
Type checking!
● Symbol Table
● Type Mismatch
● Undeclared Variable
● Operation Mismatch
Testing Plan
● Step 1: Run file through antlr to verify correct parse tree. If incorrect,
modify grammar and repeat.
● Step 2: Translate file, using strings to verify correct symbol tables and
type checking. We printed out the expected results and compared to the
output. If incorrect, modify symbol table or type checking method.
● Step 3: Check output versus parallel java program. If incorrect, analyze
and modify Translator or boardr file.
Example Test Program
Input
1.
2.
3.
4.
5.
6.
7.
8.
Player One;
Board board = 5;
Die = 1;
Rule types([1]){
String s = "string";
boolean[] b = [true];
String[] sa = ["hello", 1];
};
Output
javac BoardrTranslator.java
java BoardrTranslator
../testing/typeCheckTest.boardr
text is Strings="string";
should be string: "string";
should be boolean: true
should be string: "hello"
should be string: 1
TypeMismatchError: Type error! Cannot
convert Number into String
DEMO
FunTown and Ladders
Timeline of Events
Team
Formation
Board idea
(early February)
Language
Reference
Manual (3/26)
Grammar
implemented
(4/20)
Final Report &
Presentation
Code generation
complete (5/10)
Basic Hello
World (4/25)
Begin code
generation (4/21
onwards)
Github Commits
Note: All of the earliest commits working on grammar (from late March/early April) were lost
because of Github failures.
Lessons Learned
1. Listen and be considerate of each others’ opinions.
2. Be flexible with each others’ schedules.
3. Review project continuously.
4. Figure out implementation details carefully.
What Worked Well
1. Start early on the final report.
2. Set up a group calendar.
3. Dedicate days to working on the project.
Advice
1. Remind each other of due dates.
2. Know the tools that you are using (well).
Why use Boardr?
● intuitive
● interactive
● for basic programmers
Thank you!
Download