bgd - columbia universityaho/.../14-05-14_team7_bgd.pdf · introduction bgd is a simple language...

34
BGD --The Board Game Designer

Upload: others

Post on 08-Jun-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

BGD--The Board Game Designer

Page 2: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Introduction

Xiao Huang - Project ManagerKe Wu - Language GuruYinghui Huang - System ArchitectXingyu Wang - System IntegratorDechuan Xu - System Tester

Page 3: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Introduction

● BGD is a simple language for designing board game applications ● How to use

○ Put your source code in our compiler folder○ Run $sh compile.sh your_code.bgd○ Run $sh run.sh○ Enjoy

● Sample Game○ Tic-Tac-Toe○ YushenGame

Page 4: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Introduction ● Motivation

○ At very beginning, to be honest...○ Then, we found it interesting to construct our owner language○ Want to see our language coming to earth inspires us

● Properties○ Specify common properties ○ Primitive calculation

Page 5: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Syntactic Constructs: Overview

piece_stmt

board_stmt

player_stmt

rule_stmt

function_stmt

input_stmt

Page 6: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Syntactic Constructs: Overview

State types and numbers of pieces

State size of the game board

State number of players

State what kinds of actions in your game

State the restriction rules of the actions

Page 7: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Syntactic Constructs: Overview

If you want to initialize the game board with pieces, you can define an initialize function.

Format:type player position

Page 8: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Syntactic Constructs: Primitive data type: int, double, boolean, stringDerived data type: array, pos● pos: a data type for position on the board, consisting of two int value● position := (1,1)

Key word: PIECE, PLAYER, BOARD, RULE, FUNCTION, YES, NO, NIL…Statements: ● if-else statement, while statement, for-loop statement● function-definition statement

We use indentation to identify a suite

Page 9: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Translator Architecture

Lexer: lexing.pyParser: yaccing.pyICG: traverse.pyCompile shell code: compile.sh

Running shell code: run.sh

Page 10: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Translator Architecture: Front Endtic-tac-toe.bgd Token Flow

Page 11: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Translator Architecture: Front Endtic-tac-toe.bgd Parser

Page 12: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Translator Architecture: Front Endtic-tac-toe.bgd AST

Page 13: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Translator Architecture: Front Endtic-tac-toe.bgd

GameDesigner.java

Page 14: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Translator Architecture: Back End

Page 15: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Runtime Environment

Java Compiler

CompilerFrontend

Source Code

GameDesigner.java

BytecodesJVM

compile.sh:

Page 16: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Software Development Environment

Page 17: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Compiler-Generator Tools

PLY (Python Lex-Yacc)Python 2.7

● Lexer lexing.py● Parser yaccing.py● ICG traverse.py

Page 18: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Test Plan

● Mainly focused on frontend● Based on Python unittest module● Split into four parts:

○ lexer○ yaccer○ traverser○ general tests

Page 19: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Test Plan: Lexer

1. Lexemes and token types

2. Indentation test3. Sample code test

Page 20: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Test Plan: Yaccer

● Feed yaccer with test cases and inspect result non-terminals manually.

Page 21: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Test Plan: Traverser

● Feed traverser with test cases to generate ICG (java code), and inspect code manually.

Page 22: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Test Plan: General Tests

● PLY○ illegal characters warning for Lex○ Syntax error and SR conflicts warnings for Yacc○ Parsing table generated

● Java○ Eclipse compile-time debugging○ GUI

Page 23: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

PROJECT MANAGEMENT

● Start early○ As early as Jan.28th○ Detailed discussion followed

● Communicate often○ Meet Every Tuesday

● Keep all files up to date

Page 24: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

PROJECT MANAGEMENT

● Waterfall Model

Page 25: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

PROJECT MANAGEMENT

Github Commits

Project Begin

Spring Break

Tutorial & LRM

Before Final

Final Version

Page 26: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

PROJECT MANAGEMENTE

very

Day

Time to Submit

Page 27: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Conclusion● Lessons Learned

○ Plan ahead○ Meet often○ Divide work reasonably○ Debug before commit is important!

Page 28: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Conclusion● What Worked Well

○ Tuesday after developing…○ Divide work/everyone

responsible for one part

Page 29: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Conclusion● What If We Could Start Over

○ Setup grammar asap○ Raise more language examples at first for test

Page 30: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Conclusion● Why Use Our Language

○ Easy to use■ 12 lines to implement Gomoku game

○ Fun to design your own game■ YushenGame

○ Cross Platform■ Java as target language

Page 31: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Demo

Demo For our Language:

Let’s have some fun!

Page 32: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Demo

Program 1: YushenGameProgram 2: GomokuProgram 3: Init

Page 33: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

We had fun in a team!

Page 34: BGD - Columbia Universityaho/.../14-05-14_Team7_BGD.pdf · Introduction BGD is a simple language for designing board game applications How to use Put your source code in our compiler

Q&A

THANKS!