Unformatted text preview:

COMS W4115 Programming Languages and Translators Event Driven State Language EDSL Language Reference Manual LRM Christopher D Sargent cds2131 columbia edu October 17 2007 3 Language Manual This manual is intended to be chapter 3 of the final report and as such the numbering convention starts at 3 It is assumed that the user has read and understands the proposal white paper and therefore this chapter needs no introduction 3 1 Token A token can be whitespace a comment an identifier a keyword a literal or an operator 3 1 1 Whitespace Whitespace t n r n Whitespace consists of blanks or spaces horizontal tabs and newlines or a concatenation of one or several of these For purposes of compatibility with UNIX and Windows platforms a newline may be either a linefeed character or a carriage return followed by a linefeed Whitespace serves no other purpose than to separate other tokens 3 1 2 Comment Comment Traditional Comment End of Line Comment Traditional Comment Comment End Comment End Comment End Star Comment End Comment End Star Comment End Star Comment End End of Line Comment Characters in End of Line Comment Characters in End of Line Comment n r n Characters in End of Line Comment n r n The traditional comment begins with the characters and ends with the characters It can span multiple lines but it does not nest with other comments The end of line comment begins with the characters and ends with the newline character or characters 3 1 3 Identifier Identifier Characters in Identifier Characters in Identifier A Z a z A Z a z 0 9 An identifier begins with at least one letter and follows with a sequence of zero or more letters and digits Identifiers are case sensitive and may have any length subject to platform specific limitations 3 1 3 1 Keyword A keyword is an identifier that has special meaning within the language Keywords should not be used except for their intended purpose Keywords are identified within the following sections of this document by their courier font 3 1 4 Literal Literal Boolean Literal Integer Literal Real Literal Boolean Literal true false Integer Literal Decimal Literal Hexadecimal Literal Binary Literal Decimal Literal 0 9 Hexadecimal Literal 0 x X A F a f 0 9 Binary Literal 0 y Y 0 1 Real Literal 0 9 Exponent 0 9 0 9 Exponent Exponent Exponent e E 0 9 A Boolean literal has one of two values either true or false An integer literal can be a decimal hexadecimal or binary number The prefix is necessary for an LL 2 parser to be able to distinguish the three different kinds of integer A real literal consists of an integer part a decimal point a fraction part an e or E an optionally signed integer exponent The integer and fraction parts both consist of a sequence of digits Either the integer part or the fraction part not both may be missing either the decimal point or the e and the exponent not both may be missing 1 3 1 5 Operator The function of the operators may depend on their operands See section 3 2 for their usage within expressions 3 2 Type and Type Conversion There are four basic types The first three types are simple value storage types The last is unique in that it stores a value but it also operates on that value Like the Boolean literal a Boolean variable takes either the true or false value 1 Brian W Kernighan and Dennis M Ritchie The C Programming Language Second Edition Murray Hill Prentice Hall 1988 194 The integer variable takes a 32 bit signed integer The minimum value of an integer is 2147483648 and the maximum is 2147483647 The real variable takes a 64 bit double precision real Its size and representation are governed by ANSI IEEE Std 754 1985 A timer has the same size and representation as a positive real but it is constantly decremented until its value reaches zero Its units are seconds relative to wall clock time Automatic type conversion may occur as a result of certain operators and their required operands Automatic or implicit conversion is the only allowed type conversion mechanism 3 2 1 Boolean and Integer A bool may be converted to an int without loss If its value is false then its integer representation will be 0 If its value is true then its integer representation will be 1 3 2 2 An int may be converted to a bool with data loss If its value is 0 then its Boolean representation will be false If its value is not 0 either a positive or negative value then its Boolean representation will be true Integer and Real An int may be converted to a real without loss Its value is exactly the same with the exception that it has a fractional component equal to zero A real may be converted to an int with data loss Not only will its fractional component be truncated towards zero but if the magnitude of its whole number component exceeds the minimum or maximum for an integer it will be reduced to that value 3 2 3 Real and Timer A timer may not take a value that is not an acceptable real value In addition a timer may not store a negative value If a timer is assigned a negative value its sign will be inverted The value that a timer currently has may be converted to a real without loss 3 3 Expression The precedence of the expressions is in order that the expressions are in in this section 3 3 1 Primary Expression primary expression Identifier Literal expression The primary expressions consist of identifiers literals and expressions in parentheses Identifier See section 3 1 3 Literal See section 3 1 4 expression A parenthesized expression is equivalent to the same expression without the parentheses 3 3 2 Unary Expression unary expression primary expression unary expression unary expression The unary operators and evaluate from right to left unary expression For the or negative operator the result of the evaluation is the negative of the operand unary expression For the or logical negation operator the result of the evaluation is true if the operand is false and false if the operand is true 3 3 3 Multiplication Division or Remainder Expression multiplication expression unary expression multiplication expression unary expression multiplication expression unary expression multiplication expression unary expression The multiplication division and remainder operators and evaluate from left to right multiplication expression unary expression For the or multiplication operator the result of the first operand is multiplied by the result of the second operand multiplication expression unary expression For the or division operator the result of the first operand is


View Full Document

Columbia COMS W4115 - Event Driven State Language (EDSL)

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 Event Driven State Language (EDSL) 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 Event Driven State Language (EDSL) 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?