DOC PREVIEW
Columbia COMS W4115 - Portfolio Simulation Language Language Reference Manual

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1 PSL: Portfolio Simulation Language Language Reference Manual Alexander Besidski Jian Huang [email protected] [email protected] Xin Li Wei-Chen Lee [email protected] [email protected] October 18, 20042 Introduction PSL is a compiled financially oriented programming language. It aims to deliver easy-to-learn powerful programming tools for financial engineers, traders, investment bankers as well as finance major students. The basic syntax structure of PSL is similar to C++ and Java, yet much simpler in comparison. A lot of complex features, such as pointers and object overloading, do not appear in PSL. Anyone with a minimum amount of programming or financial experience could easily delve into PSL and write powerful programs to achieve quite interesting and practical financial trading tasks without spending much time or effort. Therefore PSL is a rather high-level language. PSL compiler is written in Java. Although PSL provides users with a procedure-based programming interface, internally PSL is a pure object-oriented implementation. This is reflected in the complex types defined in PSL, which are meant to model real financial securities. It enables users to manipulate these objects through their corresponding member functions, which enable them to perform some highly professional practices such as portfolio management and dynamic stock market simulation. 1. Lexical Conventions PSL defines 4 types of tokens – identifiers, keywords, constants, expression operators and separators. 1.1 Comments Single line C-style // comments 1.2 Identifiers Identifier is a sequence of letters and digits where the first character must be either a character or an underscore. PSL is a case-sensitive language so that identifiers with different casing are distinguished. 1.3 Keywords The following is a list of all keywords supported by PSL. for if then else break string continue function true false return while int real void stock bond portfolio portfolio boolean program 1.4 Constants PSL supports 4 types of constants – Boolean, string, integer and real. 1.4.1 Strings A string is a sequence of characters surrounded by double quotes (“”). In order to express double quotes within a string they need to be escaped via the backslash character. (‘\”’) 1.4.2 Integers An integer constant is simply a sequence of digits. Integer values are stored as 32 bit signed numbers. 1.4.3 Real Real numbers are stored as 64 bit fixed precision values and consist of an integer part followed by a decimal point, a fraction part and an optionally signed integer exponent. 1.4.4 Boolean These constant can only take on two values “true” or “false”. 2. Expressions PSL has 7 expression precedence levels that are explained in the sections below in the order of decreasing priority. 2.1 Primary Expressions 2.1.1 All four types of constants integer, real, string, boolean 2.1.2 Identifiers All identifiers must be properly declared before being used.3 2.1.3 ( expression ) Any parenthesized expression is considered to be a primary expression that maintains all of the attributes of the un-parenthesized version. 2.1.4 primary-expression [ expression ] This notation is only applicable to arrays with the type of the expression being an integer. PSL will only support one-dimensional arrays. 2.1.5 identifier ( expression-list opt ) This notation is applicable to function calls where primary-expression. PSL allows recursive function calls. Simple types are passed in by value while complex types such as portfolio and stock and passed in by reference. 2.1.6 identifier. method-name ( expression-list opt ) This notation applies to complex types such as stock and bond. It is used to modify and read their underlying data. The dot operator is left associative. (yahoo.getExpectedFuturePrice()) 2.1.7 identifier.property-name This notation applies to complex types such as stock and bond. It is used to access properties in a Style similar to that of C# programming language. In PSL all properties can be read and set. (yahoo.price) 2.2 Unary expressions. Unary operators are right associative 2.2.1 - expression Negative of an expression. 2.3 Multiplicative operators These types of operators are left associative. 2.3.1 expression * expression, expression / expression The multiplication operators are valid for real and integer data types. If a real is multiplied by an integer the resulting value is a real. 2.4 Additive operators These types of operators are left associative 2.4.1 expression + expression The + operator is valid for all types except for boolean. If either expression is a string then both expressions must be strings and the resulting value is a string. Otherwise the result is converted to a real if at least one expression is a real and to an integer if bother operands are integers. 2.4.2 expression - expression Same semantics as for the + operator with the exception of strings not being allowed. 2.5 Relational operators 2.5.1 expression >= expression 2.5.2 expression > expression 2.5.3 expression < expression 2.5.4 expression <= expression These operators yield a boolean true if the specified expression is true and false otherwise. 2.6 Equality operators 2.6.1 expression == expression 2.6.2 expression != expression These operators are right associative and have boolean return values.4 2.7 Logical operators 2.7.1 expression && expression 2.7.2 expression || expression These operators have the semantics that are similar to C and Java. Both are left associative and require both operands to be of type boolean. 2.8 Assignment operator 2.8.1 lvalue = expression In PSL the assignment operator is not recursive unlike its C and Java counterparts. The operator is applicable to all PSL data types and arrays. lvalue concept is analogous to that of C. 3. Declarations Declarations are used within function definitions and the main body of a PSL program. Their purpose is to provide the compiler with information about storage and behaviors of the identifiers. A declaration consists of a type specifier followed by a declarator. 3.1 Type specifiers PSL allows the following type specifiers: int, real, string, boolean, portfolio, stock, bond, cash 3.2 Declarators Two forms or declarators are permitted. identifier – declares a single reference to a type


View Full Document

Columbia COMS W4115 - Portfolio Simulation Language Language Reference Manual

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
Download Portfolio Simulation Language Language Reference Manual
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Portfolio Simulation Language Language Reference Manual 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 Portfolio Simulation Language Language Reference Manual 2 2 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?