1 COMS W4115 Programming Languages and Translators Language Reference Manual =============================== COMS W4115 Programming Languages and Translators =============================== (Professor: Stephen A. Edwards) Fantasy Football Stat Tracker Compiler: Language Reference Manual Michael Lam Email: [email protected] Phone: 215-815-5629 Due Date: 10/18/20072 COMS W4115 Programming Languages and Translators Language Reference Manual Table of Contents 1 Introduction........................................................................................................................................... 3 2 Lexical Conventions ............................................................................................................................. 3 2.1 Tokens ......................................................................................................................................... 3 2.2 Comments.................................................................................................................................... 3 2.3 Identifiers .................................................................................................................................... 3 2.4 Keywords .................................................................................................................................... 4 2.5 Constants ..................................................................................................................................... 4 2.6 Operator....................................................................................................................................... 4 2.7 Data Types................................................................................................................................... 5 3 Declarations .......................................................................................................................................... 5 3.1 QB Type ...................................................................................................................................... 5 3.2 RB Type ...................................................................................................................................... 5 3.3 WR Type ..................................................................................................................................... 5 3.4 TE Type....................................................................................................................................... 5 3.5 KKR Type ................................................................................................................................... 5 3.6 DEF Type .................................................................................................................................... 5 4 Statements ............................................................................................................................................. 6 4.1 Conditional Statements................................................................................................................ 6 4.2 Looping Statements ..................................................................................................................... 6 4.3 Print Statements........................................................................................................................... 6 5 Scope..................................................................................................................................................... 6 6 Built-in Functions ................................................................................................................................. 7 7 Functions............................................................................................................................................... 8 8 Sample Program.................................................................................................................................... 93 COMS W4115 Programming Languages and Translators Language Reference Manual 1 Introduction My inspiration for designing a Fantasy Football Stat Tracker compiler transpired while participating in a fantasy football league with some friends. While the cost for participating in the fantasy football league is free of charge, most of the online fantasy football services charge a bundle for using their online stat tracker. The FFSTC will provide features for gathering player statistics, sorting based on category type, filtering by position type, stats comparison, and search by player name. In this version of the FFSTC, statistics will only be available for the 2006 Fantasy Football Season. 2 Lexical Conventions 2.1 Tokens There are six types of tokens in this language: identifiers, keywords, constants, strings, expression operators, and separators. A whitespace must be used to separate tokens. 2.2 Comments FFSTC supports single and multi-line comments. Single line comments are denoted using the notations @@. Multi line comments begin with @% and ends with %@ Example: @@ This is a valid comment @%This is also a valid comment%@ 2.3 Identifiers An identifier is a sequence of letters and digits with the first character beginning with an alphabet. Identifiers are case sensitive; the “_” is allowable4 COMS W4115 Programming Languages and Translators Language Reference Manual 2.4 Keywords The following are identifiers reserved as keywords and may not be used otherwise. while endwhile QB TeamName if else RB bool endif bool WR int FALSE TRUE TE for endfor KKR continue break DEF The following are identifiers reserved for designating team names. BUF BAL HOU DEN MIA CIN IND KAN NE CLE JAC OAK NYJ PIT TEN SD DAL CHI ATL ARI NYG DET CAR SF PHI GB NO SEA WAS MIN TB STL 2.5 Constants Three types of constants are allowed in FFSTC: integer, double, and string. All constants are capitalized. Example: const MAXYARDS = 100; 2.6 Operator The following operators can be used in FFSTC: = *= += -= /= == > < >= <= && || != ! + - * /5 COMS W4115 Programming Languages and Translators Language Reference Manual 3 Data Types The following table shows the data types in FFSTC: QB int RB bool KKR TE DEF TeamName 4 Declarations Declaring variables in FFSTC can take the following form: QB myQuarterBack; RB
View Full Document