Unformatted text preview:

Draft Language Reference Manual Equity Portfolio Statistical Analysis Language EPSAL May 3rd 2009 v 1 0 Charles Neher cgn2103 columbia edu COMS W4115 Programming Languages and Translators Professor Stephen Edwards Spring 2009 Semester 1 Table of Contents 1 1 Language Introduction 3 2 Document Conventions 3 3 Lexical Conventions 3 3 1 Tokens 3 3 2 Comments 3 3 3 Identifiers 3 3 4 Keywords 4 3 5 Constants 4 3 6 Integer Constants 4 3 7 Character Constants 4 3 8 Floating Constants 4 3 9 String Literals 5 4 Expressions 5 4 1 Primary Expressions 5 4 2 Functions 5 4 3 Multiplicative Operators 6 4 4 Additive Operators 6 4 5 Relational Operators 6 4 6 Logical AND Operator 7 4 7 Logical OR Operator 7 4 8 Assignment Operator 7 4 9 Comma Operator 7 5 5 1 6 Declarations 8 Type specified 8 Statements 8 6 1 Expression Statement 8 6 2 Selection Statement 9 6 3 Iteration Statements 9 6 4 Jump Statement 9 1 This LRM has referenced the framework of The C Programming Language by Brian Kernigan and Dennis Ritchie pages LTM 191 231 Prentice Hall 1988 2 7 Appendix 10 1 Language Introduction This manual describes the EPSAL Equity Portfolio Statistical Analysis Language which is a Statistical computing language similar to simple version of the R 2 with built in function specific to Equity time series analysis The most important aspect of the language is for the user to have to the ability to express algorithms in the language to write their own statistical functions with a simple standard library and set of operators that can be combined implement an algorithm in an optimal fashion 2 Document Conventions This manual will have 2 distinct syntax notations when describing language notations Syntactic categories are indicated in Ariel italic type and literal words and characters will be in bold Lucidia Sans Typewriter 12 point 3 Lexical Conventions 3 1 Tokens There are 5 classes of tokens in the EPSAL language Keywords identifiers constants string literals and operators All blanks newlines vertical tabs and comments as described in section 3 2 are considered whitespace and ignored during tokenization 3 2 Comments The Characters introduces a comment and terminates with and will be ignored by the complier There are no multiline comments or nesting and they should not occur within a string or character literals 3 3 Identifiers An identifier is used for variable names and consists of a series of letters and digits First character must be a letter and may be a combination of Upper and lower case letters as well as digits The language is not case sensative 2 http wiki r project org rwiki doku php 3 3 4 Keywords The following identifiers are reserved for keywords and may not be used in any other context except a componenet of a combination of letters or digits Keyword purpose DIST TS PRINT ERROR IO ARRAY LIST CHAR INT FLOAT IF THEN ELSE RETURN GOTO BREAK CONTINUE Distribution time series Printing Error handling Input output Array List Character Integer Floating Point Program control 3 5 Constants There are 4 types of constants Integer Character Floating and String Literals 3 6 Integer Constants An integer constant is a series of digits and may not begin with 0 3 7 Character Constants A character constant is a sequence of one or more characters enclosed by single quotes A 3 8 Floating Constants A floating constant consist of an integer part decimal part a fraction part an e or E and an optionally signed integer exponent A digit string may be of any length and the location of the radix point by a dot If the radix point is omitted it is assumed to lie to the right end of the string 4 Either the integer part of the fraction part but not both may be missing 3 9 String Literals A String literal or constant is a sequence of characters surrounded by double quotes A string has an array of characters and is initialized with the given characters The compiler puts a null byte 0 which is appended to single string or concatenated string so that he program can find its end 4 Expressions In EPSAL an expression is a sequence of operators and applicable operands whose highest order precedence relates the organization sub sections in chapter 4 of this LRM 4 1 Primary Expressions Primary expressions are identifiers numbers strings or expressions in parenthesis Primary expression Identifier Constant String expression An identifier is a primary expression provided that is has been declared with accepted type of int float or string Arrays A postfix expression followed by an expression in square brackets is a postfix expression denoting a subscribed array reference The index of the array is specified by integer constants Example identifier expression integer constant 4 2 Functions A function call is primary postfix expression followed by the parentheses with a list of comma separated list of assignment expressions which represent the input parameters of the function The function itself is a sequence of statements that result in a return value or call another function in relation to a recursive algorithm Example example Func int identifier assignment expression 1 assignment expression 2 etc 5 4 3 Multiplicative Operators The multiplicative operators group left to right If one of the operands is 0 in the division operation the result is undifined If both operands are non negative the remainder is also nonnegative and smaller than the divisor Multiplicative expression expression expression expression expression operator is the remainder of the first operand by the second 4 4 Additive Operators The additive operators and group left to right The rest of the operator is the sum of the operands and the operand is the difference The syntax is as follows Additive expression Additive expression Additive expression Additive expression additive expression 4 5 Relational Operators The relational operators group left to right and evaluates to either 0 or 1 The operators less greater less or equal greater of equal equal to all yield 0 if false and 1 if true relational expression relational expression relational expression relational expression relational expression relationa expression relational expression relational expression relational expression relational expression relational expression 6 4 6 Logical AND Operator Operators of AND logical type are Boolean and equal to 1if both operands are not equal to 0 and 0 for all other cases The operands must be on same type and are valuated from left to right logical expression AND logical expression 4 7


View Full Document

Columbia COMS W4115 - Equity Portfolio Statistical Analysis 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 Equity Portfolio Statistical Analysis 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 Equity Portfolio Statistical Analysis 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?