Unformatted text preview:

MatrEL Matrix Entertainment Language Rochelle Palting rcp2122 Columbia University COMS 4115 Fall 2008 Table of Contents 1 Introduction 4 1 1 Background 4 1 2 Goals of MatrEL 4 2 Language Tutorial 5 2 1 Example 5 3 Language Manual 7 3 1 Introduction 7 3 2 Lexical conventions 7 3 2 1 Comments 7 3 2 2 Identifiers Names 7 3 2 3 Keywords 7 3 2 4 Constants 7 3 3 What s in a Name 8 3 4 Conversion 8 3 4 1 Integers and Strings 8 3 5 Expressions 8 3 5 1 Primary expressions 8 3 5 2 Unary operators 9 3 5 3 Multiplicative operators 9 3 5 4 Additive operators 9 3 5 5 Relational operators 9 3 5 6 Equality operators 10 3 5 7 expression and expression 10 3 5 8 expression or expression 10 3 6 Declarations 10 3 6 1 Type specifiers 10 3 6 2 int declarators 10 3 6 3 boolean declarators 10 3 6 4 string declarators 10 3 6 5 matrix declarators 10 3 6 6 cell declarators 11 3 7 Statements 11 3 7 1 Expression statement 11 3 7 2 Compound statement 11 3 7 3 Conditional statement 11 3 7 4 While statement 11 3 7 5 Return statement 12 3 8 Scope rules 12 3 8 1 Lexical scope 12 3 9 Types revisited 12 3 9 1 Functions 12 3 9 2 Matrices 12 3 9 3 Cells 13 3 10 Formatted Output 13 4 5 6 7 8 Project Plan 14 4 1 Process 14 4 2 Programming Style 14 4 3 Project Timeline 14 4 4 Team Responsibilities 14 4 5 Software Development Environment 14 4 6 Project Log 15 Architectural Design 16 5 1 Architecture 16 Test Plan 17 6 1 Goals 17 6 2 Hypothesis 17 6 3 Methods 17 6 4 Tools 17 Lessons Learned 17 Appendix 18 8 1 Code Listing 18 8 1 1 scanner ml 18 8 1 2 parser mly 19 8 1 3 ast mli 21 8 1 4 interpreter ml 22 8 1 5 printer ml 26 1 Introduction The MatrEL programming language is designed to help developers implement single or multiplayer board games Its syntax is similar to C providing a few simple types and board game tailored methods allowing the language to be easy to learn and use MatrEL is intended to be a compact language containing just enough functionality for a developer to create a fun and challenging game without unnecessary functionality and features that could make the language more difficult and confusing to use 1 1 Background The entertainment that board games have provided over generations has been and continues to be a favorite pastime With the ongoing technology innovations gaming has taken on new forms and exists on various media from internet games handheld players and game consoles MatrEL allows the developer to bring the old time favorite games into the current times allowing the player to play these games in electronic form The developer can also try out his or her inventive style by creating a new and fascinating game In both cases MatrEL is fun for the developer and the game player 1 2 Goals of MatrEL MatrEL was designed with the goals and objectives of being intuitive and optimal performance Since MatrEL is designed with the basics of board game creation in mind the programmer will focus on the rules and dynamics of the game rather than get lost in the language specifics The objects and data structures that make up MatrEL have been chosen to provide optimal search and store functions so that developing testing and execution of programs do not lag in time and performance 2 Language Tutorial Before creating a board game using MatrEL the developer should have a clear understanding of the game to be developed Specifically the following details should be decided How many players can play the game How big can the board game be What are the allowable moves by each player Under what conditions does a player win or lose at the game MatrEL uses a square matrix object to simulate the board game The matrix consists of rows and columns which each contain cells that represent a square on the game board A program is created by performing a sequence of sets and queries on these cells Based on the predefined win lose rules the game sequence continues until there is a clear win or lose to the game While each game created will be unique in its own way the basic steps that the developer will follow to program the game will be the same 1 Create win lose rules a Create a boolean function that takes a game board position as input and returns true or false as to whether that new position resulted in a win or lose situation for the player 2 Initialize game variables number of players and game board size a In MatrEL it is required that the game board be a square matrix the number of rows and the number of columns must be equal 3 Create the game sequence a The program should loop through the players turns in actions and exit if a win lose condition is satisfied 2 1 Example The following example uses MatrEL to implement Tic Tac Toe game Tic Tac Toe initialize gameboard to a 3x3 matrix and set all cell entries to empty matrix gameboard 3 gameboard create the three in a row winning conditions boolean threeInARow matrix m cell pos string value if every m pos row value return true elseif every m pos column value return true elseif every m value return true elseif every m value return true else return false game loop boolean gameOver false string userInput empty string value empty cell userPos 1 1 string player empty while gameOver printout Enter next player number getInput stdin player printout Player player Enter selection as row column getInput stdin userPos printout Enter position value X O getInput stdin value gameboard userPos value if threeInARow gameboard userPos value printout Player player wins gameOver true elseif any gameboard empty printout Game tied No more moves left gameOver true printMatrix gameboard 3 Language Manual 3 1 Introduction MatrEL is a computer language designed for board game creation Examples of games that can be created are Tic Tac Toe Minesweeper and Battleship This language reference manual details the features of MatrEL and how one can program in this exciting language 3 2 Lexical conventions In MatrEL there are six kinds of tokens identifiers keywords constants strings expression operators and other separators A sequence of one or more separators is required in between tokens Blanks tabs newlines and comments are used as separators and are otherwise ignored by the compiler 3 2 1 Comments The string of characters that begins with and ends with is treated as a comment 3 2 2 Identifiers Names An identifier is a sequence of letters and digits The first character must be a letter The underscore symbol may be used as part of an identifier Identifiers are case sensitive uppercase and lowercase letters are


View Full Document

Columbia COMS W4115 - MatrEL - Matrix Entertainment Language

Documents in this Course
YOLT

YOLT

13 pages

Lattakia

Lattakia

15 pages

EasyQL

EasyQL

14 pages

Photogram

Photogram

163 pages

Espresso

Espresso

27 pages

NumLang

NumLang

6 pages

EMPATH

EMPATH

14 pages

La Mesa

La Mesa

9 pages

JTemplate

JTemplate

238 pages

MATVEC

MATVEC

4 pages

TONEDEF

TONEDEF

14 pages

SASSi

SASSi

16 pages

JTemplate

JTemplate

39 pages

BATS

BATS

10 pages

Synapse

Synapse

11 pages

c.def

c.def

116 pages

TweaXML

TweaXML

108 pages

Load more
Loading Unlocking...
Login

Join to view MatrEL - Matrix Entertainment Language and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view MatrEL - Matrix Entertainment Language and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?