PLT Project Language Reference Manual

Similar documents
PLT 4115 LRM: JaTesté

GAWK Language Reference Manual

TML Language Reference Manual

TaML. Language Reference Manual. Adam Dossa (aid2112) Qiuzi Shangguan (qs2130) Maria Taku (mat2185) Le Chang (lc2879) Columbia University

Perdix Language Reference Manual

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)

LaTenS Language Reference Manual

CSE 340 Fall 2014 Project 4

COMS W4115 Programming Languages & Translators FALL2008. Reference Manual. VideO Processing Language (VOPL) Oct.19 th, 2008

Final Report on Cards the Language. By Jeffrey C Wong jcw2157

Lecture Code Generation for WLM

MP 3 A Lexer for MiniJava

B E C Y. Reference Manual

VENTURE. Section 1. Lexical Elements. 1.1 Identifiers. 1.2 Keywords. 1.3 Literals

Lexical Considerations

ML 4 A Lexer for OCaml s Type System

1 Lexical Considerations

CLIP - A Crytographic Language with Irritating Parentheses

Last Time. What do we want? When do we want it? An AST. Now!

Syntactic Analysis. The Big Picture Again. Grammar. ICS312 Machine-Level and Systems Programming

A clarification on terminology: Recognizer: accepts or rejects strings in a language. Parser: recognizes and generates parse trees (imminent topic)

Lexical Considerations

PIPELINE LANGUAGE REFERENCE MANUAL

CS 536 Midterm Exam Spring 2013

MP 3 A Lexer for MiniJava

ASML Language Reference Manual

Spoke. Language Reference Manual* CS4118 PROGRAMMING LANGUAGES AND TRANSLATORS. William Yang Wang, Chia-che Tsai, Zhou Yu, Xin Chen 2010/11/03

Slang Reference Manual

Flow Language Reference Manual

MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Introduction to Compiler Design

Crayon (.cry) Language Reference Manual. Naman Agrawal (na2603) Vaidehi Dalmia (vd2302) Ganesh Ravichandran (gr2483) David Smart (ds3361)

Firedrl Language Reference Manual FIREDRL. Language Reference Manual. COMS 4115 Programming Languages and Translators

giraph a language for manipulating graphs

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

The SPL Programming Language Reference Manual

A lexical analyzer generator for Standard ML. Version 1.6.0, October 1994

Regular Expressions. Agenda for Today. Grammar for a Tiny Language. Programming Language Specifications

YOLOP Language Reference Manual

DINO. Language Reference Manual. Author: Manu Jain

Lexical Analysis. Introduction

Compiler Techniques MN1 The nano-c Language

A Pascal program. Input from the file is read to a buffer program buffer. program xyz(input, output) --- begin A := B + C * 2 end.

Project 2 Interpreter for Snail. 2 The Snail Programming Language

Language Reference Manual

Language Reference Manual simplicity

Syntax. A. Bellaachia Page: 1

Simple Lexical Analyzer

Assignment 1. Due 08/28/17

Topic 3: Syntax Analysis I

Project 1: Scheme Pretty-Printer

ASTs, Objective CAML, and Ocamlyacc

LEXIMET: A Lexical Analyzer Generator including McCabe's Metrics.

Syntax Analysis/Parsing. Context-free grammars (CFG s) Context-free grammars vs. Regular Expressions. BNF description of PL/0 syntax

CHIL CSS HTML Integrated Language

Defining Program Syntax. Chapter Two Modern Programming Languages, 2nd ed. 1

JFlat Reference Manual

COLOGO A Graph Language Reference Manual

Mirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006

The PCAT Programming Language Reference Manual

Windshield. Language Reference Manual. Columbia University COMS W4115 Programming Languages and Translators Spring Prof. Stephen A.

UNIT- 3 Introduction to C++

Context-free grammars (CFG s)

Part 5 Program Analysis Principles and Techniques

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

CSE 413 Programming Languages & Implementation. Hal Perkins Autumn 2012 Grammars, Scanners & Regular Expressions

CSE 582 Autumn 2002 Exam Sample Solution

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program

CSEP 501 Compilers. Languages, Automata, Regular Expressions & Scanners Hal Perkins Winter /8/ Hal Perkins & UW CSE B-1

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Informal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility

Lexical Analysis (ASU Ch 3, Fig 3.1)

Data Types and Variables in C language

Decaf Language Reference

Jianning Yue Wookyun Kho Young Jin Yoon. AGL : Animation applet Generation Language

GBL Language Reference Manual

VLC : Language Reference Manual

Programming in C UVic SEng 265

Programming in C. What is C?... What is C?

Triangle Manipulation Language TrML Language Reference Manual

CSE 413 Programming Languages & Implementation. Hal Perkins Winter 2019 Grammars, Scanners & Regular Expressions

Lexical Analysis. Chapter 1, Section Chapter 3, Section 3.1, 3.3, 3.4, 3.5 JFlex Manual

SMURF Language Reference Manual Serial MUsic Represented as Functions

Programming in C. What is C?... What is C?

CS241 Final Exam Review

The MicroC Compiler. Stephen A. Edwards. Fall Columbia University

JME Language Reference Manual

Twister: Language Reference Manual

M/s. Managing distributed workloads. Language Reference Manual. Miranda Li (mjl2206) Benjamin Hanser (bwh2124) Mengdi Lin (ml3567)

Language Reference Manual

CPS 506 Comparative Programming Languages. Syntax Specification

The MicroC Compiler. Stephen A. Edwards. Fall Columbia University

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

Decaf Language Reference Manual

EDA180: Compiler Construc6on. Top- down parsing. Görel Hedin Revised: a

Sprite an animation manipulation language Language Reference Manual

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

ucalc Patterns Examine the following example which can be pasted into the interpreter (paste the entire block at the same time):

Transcription:

Easysurvey - - - an online survey generate language PLT Project Language Reference Manual Team Members: Taotao Li tl2453 Luyao Shi ls2899 Zaisheng Dai zd2140 Yifan Zhang yz 2365 Professor: Stephen A. Edwards

1. Language description......3 2. Input and output.... 3 3. Lexicon 3 3.1 Token separator.....3 3.2 Comments.3 3.3 Constants..3 3.4 Identifier 3 3.5 Keywords...... 4 3.6 Separators...... 5 3.7 Operators....6 3.7.1 ASSIGN.....6 3.7.2 Dot...... 6 3.7.3 Comparison Operator..6 3.8 Data Types..... 6 3.9 Attributes 7 3.10 Embedded Action..8 4. Declaration........9 4.1 QuestionSet Declaration...... 9 4.2 Other datatype declaration.......9 5. Function definition............9 6. Statements.........10 6.1 Common statements.........10 6.2 Block statements..... 10 6.3 If statements....10 7. Expressions.......10 7.1 Simple expressions..... 10 7.2 Assignment expressions........10 7.3 Special expressions......11 7.4 Call expressions..... 11 7.5 Condition expressions.... 12 8. Scope.....12 9. Conditionals.. 12 10. Code snippets....13 11. Syntax summary....15 2

1.Language Description Online survey can find its importance in areas such as Market Research, Event Planning, Customer Feadback, Product Planning and Education & Training. EasySurvey is a light weight language which is designed to make the onlie survey gennereation process easy and fun. EasySurvey defines a framework that can allow developer to define basic components of the online survey. User can use EasySurvey language to define Page to represent the every survey page. And each page can have several QuestionSet, each QuestionSet can have some numbers of Question. Then each question contains its own properties, such as Title and Type etc. 2. Input and output EasySurvey will accept the files with.as extension as the input file; the EasySurvey complier will compile the input file, which will be analyzed in lexically and grammatically. If everything is correct, the compiler will generate the flex page source code (.mxml). Then the output source code can be run and tested under Adobe Flash Builder. Then developer can export the application as a package, which can be run in any flash-support environment. 3. Lexicon 3.1 Token separator White space, New line \n, Carriage return \r and Horizontal tab \t are the token separators. 3.2 Comments Comments begins with /* and end with */, including everything between them. 3.3 Constants Integer: a sequence of one or more digits. String: a string starts with a double quote followed by zero or more characters, ended by a double quote 3.4 Identifier An identifier is defined as a combination of alphanumeric characters [a-z][az][0-9] and must start with a alphabet character. Length of an identifier cannot exceed 32. 3

This language is case sensitive. 3.5 Keywords if else int new Main Question Title SingleSelection MultipleSelcetion DropdownList TextField UserInput QuestionSet Display AddQuestion setvisible Image: JumpButton: 4

3.6 Separators 3.6.1 ';' ';' is used to separate statements. For example: Question question1; QuestionSet qs1= new QuestionSet(); 3.6.2 '{' and } '{' and '}' are used to separate sets like function declarations, gather the statements in if block or else block, or gathering parameters when assigning the content of the question. For example: (1) Questionlogo (QuestionSet qs1, Image logo) { } Main() { } (separating function declarations) (2) if(qs1.q1.userinput>18) { } else { } (gather statements in if block or else block) (3) Question Address; Address.Title="Where do you live?"; Address.SingleSelection={"Bronx","New Jersy","China"}; question) (assigning the content of the 3.6.2 ', ',' is used to separate the parameters and identifier. For example: The third case above. 3.6.2 '( and ) 5

'(' and ')' are used to indicate the token before (' is a function and gather the function parameters. Also, they can be used to contain the condition sentence of if. 3.7 Operators 3.7.1 ASSIGN '=' is used to represent assignment, usually used when constructing a new QuestionSet, setting the Title of the question or the content of the question. For example: question1.title= question1 ; question1.singleselection= { 1, 2 }; QuestionSet questionset1=new Questionset( ); 3.7.2 Dot '.' is usually behind a union type like QuestionSet or Question, following the elements of that union type. For example: 3.7.3 Comparison Operator question1.title, questionset1.quesstion1.userinput The comparison operator in EasySurvey includes equal, less than, greater than, less equal and greater equal wich are presented as <, >,<=,>=,== associating from left to right. Constraint: the left hand side of the operator must be userinput. 7.5 show the definition of comparison operator. 3.8 Attributes Title : are. Title is one of the attribute of the question. It is a string which will show the informant what the questions SingleSelection: 6

the informant can only choose one of the answers. MultipleSelcetion: The informant can choose multiple answers. DropdownList: The answers will represent in the form of dropdown list. TextField: The informant should type his/her answer in text field. UserInput : represent the value user input, every question has one UserInput 3.9 Data Types int: Sample: An integer is a sequence of digits. All the integer constants are views as decimal. int y; Question: Question is used to define the survey questions. It consists of Title and Type which might be one of RadioBox, DropdownList, MutipleBox, and TextArea. Sample: QuestionSet: Question Name; Name.Title="What's your name?"; Name.TextArea={10}; /* the TextArea occupy 10 characters* 7

QuestionSet is used to define a set of related question and display them as a whole part. Sample: QuestionSet qs1 = new QuestionSet(); Image: Claim an image for the use of displaying it. JumpButtorn: Jump to next or another page. 3.10 Embeded Action Display: Sample: Display a series of QuestionSet or Image. AddQuestion( ): Sample: setvisible( ): Display Image1; Display Qs1; Add a Question to a QuestionSet qs1.addquestion(name) set the visibility of a QuestionSet. The parameter should be integer, while 0 represent that the question would be hidden, the other integer would show the questionset. Sample: Qs1.setVisible(1) /*Qs1 would now be visible*/ 8

4. Declaration decl: QUESTIONSET ID ASSIGN NEW QUESTIONSET LPAREN RPAREN SEMI datatype var_decl SEMI 4.1 QuestionSet Declaration The declaration of QuestionSet has the form QUESTIONSET ID ASSIGN NEW QUESTIONSET LPAREN RPAREN SEMI For example: QuestionSet ID =new QuestionSet( ); 4.2 Other datatype declaration Other datatype declaration has the form datatype var_decl SEMI The var_decl contains a list of variable names. The datatype has the form datatype: QUESTION IMAGE JUMPBUTTORN INT For example: Question q1, q2, q3; 5. Function definition The function definition has the form fun_def : ID LPARAN args_list RPARAN LBRACE decl_list stmt_list RBRACE For example: QuesionLogo(QuestionSet qs1, Image logo) 9

{..} The args_list is a list of arguments. For example: int a, Question q1, QuestionSet qs1 The decl_list is a list of declarations. The stmt_list is a list of statements. 6. Statements 6.1 Common statements The common statements are composed with expression and a semicolon. 6.2 Block statements The block statements have the form stmt: LBRACE stmt_list RBRACE stmt_list is a list of statements. 6.3 If statements If statements have the form stmt: IF LPAREN expr RPAREN stmt %prec NOELSE IF LPAREN expr RPAREN stmt ELSE stmt 7. Expressions 7.1 Simple expressions The simple expressions include int constant or string constant and return their value. 10

7.2 Assignment expressions The assignment expressions have the form expr: ID POINT MULTIPLE ASSIGN LBRACE string_opt RBRACE (Assign the content of the question ID, noting the type of the question is MutipleSelection) ID POINT SINGLE ASSIGN LBRACE string_opt RBRACE (Assign the content of the question ID, noting the type of the question is SingleSelection) ID POINT DROP ASSIGN LBRACE string_opt RBRACE (Assign the content of the question ID, noting the type of the question is DropdownBox) ID POINT TEXT ASSIGN LBRACE INT_LITERAL RBRACE (Assign the width of the text question) 7.3 Special expressions Adding a Question to a QuestionSet is a special expression. It has the form expr: ID POINT ADDQUESTION LPARENT var_decl RPARENT The var_decl is a list of variables(id). Displaying a series of QuestionSet is a special expression. It has the form expr: DISPLAY var_decl Setting the visibility of a QuestionSet is a special expression. It has the form expr: ID POINT SETVISABLE LPARENT INT_LITERAL RPARENT 7.4 Call expressions They have the form expr: 11

ID LPAREN var_opt RPAREN 7.5 Condition expressions They have the form expr: ID POINT ID POINT USERINPUT EQ expr ID POINT ID POINT USERINPUT NEQ expr ID POINT ID POINT USERINPUT LT expr ID POINT ID POINT USERINPUT LEQ expr ID POINT ID POINT USERINPUT GT expr ID POINT ID POINT USERINPUT GEQ expr Normally, to get a UserInput, the developer should provide the UserInput of which Question in which QuestionSet. That s why the form has two ID POINT. 8. Scope Global variables have a global scope. The scope of other variables is in their function declaration block. 9. Conditionals Conditionals are used to determine the order of questions shown to readers. They are defined in the following form. If (expression of UserInput) statement else statement The else part is necessary, because it will decide which questionset to be display. For example: if ( qs1.isoncampus.userinput == OnCampus ) { qs2.setvisible(1); } else { qs3.setvistible(1); } 12

10. Code snippet: /***********function declaration*********/ QuestionLogo(QuestionSet Qs1, Image imag1) { Display Qs1, Display image1; } /***********main function<************/ Main() { /*variable declaration*/ Question Name; Question Address; Question IsOnCampus; Question Fruit; Question OnCampus; Question OffCampus: Image logo; /********Assign value to variation********/ logo ="C:\EasySury\image1x.jpg"; Name.Title="What's your name?"; Name.TextField=(10); IsOnCampus.Title="Are you living on Campus?"; IsOnCampus. SingleSelection={"off campus","on cmpus"}; Address.Title="Where do you live?"; Address.SingleSelection{"Bronx","New Jersy","China"}; Fruit.Title="Which is/are your favorite fruit?"; Fruit. MultipleSelection={"Apple", "Pear", "Banana"}; 13

OnCampus.Title="Which area?"; OnCampus. SingleSelection{"MorningSide","WestWood"}; OffCampus.Title="Which district?"; Offcampus.SingleSelection{"Manhattan", "Queens", "Bronx", "Brooklyn"} /********questionsets declaration and assignment*******/ QuesttionSet qs1=new Questionset(); qsl.addquestion(name,address,fruit); qs1.addquestion(isoncampus); /*******display the questionset********/ Diplay qs1 ; /*********function call************/ QuestionLogo(qs1,logo) ; QuestionSet qs2=questionset(); qs2.addquestion(oncampus); QuestionSet qs3=questionset( ); qs3.addquestion(offcampus); /*Condition example, we will base on the users input to show the next input. If the informant live on campus, we will display the questionset related to live on campus. */ if ( qs1.isoncampus.userinput == OnCampus ){ qs2.setvisible(1); } else { qs3.setvistible(1); } } 14

11. Syntax Summary program: program decl program fun_def fun_def : ID LPARAN args_list RPARAN LBRACE decl_list stmt_list RBRACE args_list : def_args args_list COMMA def_args def_args: datatype ID QUESTIONSET ID decl_list: decl_list decl decl: QUESTIONSET ID ASSIGN NEW QUESTIONSET LPAREN RPAREN datatype var_decl SEMI var_opt: var_decl var_decl : var var_decl COMMA var var : ID datatype: QUESTION IMAGE JUMPBUTTORN INT stmt: expr SEMI LBRACE stmt_list RBRACE\ IF LPAREN expr RPAREN stmt %prec NOELSE IF LPAREN expr RPAREN stmt ELSE stmt expr: INT_LITERAL STRING_LITERAL ID POINT MULTIPLE ASSIGN LBRACE string_opt RBRACE ID POINT SINGLE ASSIGN LBRACE string_opt RBRACE ID POINT DROP ASSIGN LBRACE string_opt RBRACE ID POINT TEXT ASSIGN LPAREN INT_LITERAL RPAREN 15

ID POINT TITLE ASSIGN STRING_LITERAL ID ASSIGN STRING_LITERAL ID POINT ADDQUESTION LPARENT var_decl RPARENT ID POINT SETVISABLE LPARENT INT_LITERAL RPARENT DISPLAY var_decl ID LPAREN var_opt RPAREN ID POINT ID POINT USERINPUT EQ expr ID POINT ID POINT USERINPUT NEQ expr ID POINT ID POINT USERINPUT LT expr ID POINT ID POINT USERINPUT LEQ expr ID POINT ID POINT USERINPUT GT expr ID POINT ID POINT USERINPUT GEQ expr string_list: STRING_LITERAL string_list COMMA STRING_LITERAL string_opt: string_list stmt_list: stmt_list stmt 16