Unformatted text preview:

DEVice Interface Language DEVIL Boklyn Wong bw2007 cs columbia edu Pranay Wilson Tigga Team Leader pt2116 cs columbia edu Vishal Kumar Singh vs2140 columbia edu Hye Seon Yi hsy2105 cs columbia edu A language that doesn t affect the way you think about programming is not worth knowing Anonymous Chapter 2 Lexical Conventions 2 1 Comments The character introduces a comment Everything on that line will be considered as a comment 2 2 Identifiers Identifier is a sequence of letter and digit with first character must be letter 2 3 Keywords The following identifiers are reserved for the language use and may not be used otherwise Object Break Continue until else volatile static auto if options while default tag entry repeat int if char repeat extern options register extern done return template done 2 4 Separators Separators which are Ignored Newline n Tab t Carriage r White Space 2 5 Types and Variables Strong type controlled language Mismatched types will not be automatically resolved or allowed by the compiler 1 Data Types Integer It is a sequence of digits Character 1 character String It is a sequence of characters separated by However It is also equivalent to array of characters Boolean The Boolean type has two values represented by the strings true and false Array The Array contains any of the supported data types Object This data type comprises of other data types and is used to abstractly represent real world entities like devices 2 Variables Each variable is of type of one of the supported data type A variable has a name Identifier and a Scope The scope can be I Global II Local 3 Initialization Integer to 0 character to String to NULL Array to NULL 4 Conversions No conversion takes place from one type to another Since the domain is Device configuration the control is in programmers network administrators hand e g Object FirewallDevice a FirewallDevice b FirewallDevice E g int a e g string IPAddress IPAddress a b c d 2 6 Operators Declarations Expressions Statements and Blocks 2 6 1 Operators The following is the list of Operators in our language NOT AND OR 1 Operator Addition 2 Operator Subtraction 3 Operator Multiplication 4 Operator Division 5 Operator remainder of division 6 AND Logical AND operation 7 OR Logical OR 8 NOT Not operation 9 Increment 10 Decrement 11 Assignment 12 Less then 13 Greater then 14 Less then equal to 15 Greater then equal to 16 equal to This is for inheritance kind of relationship among object This is for composition kind of relationship among objects The assignment operator can be used for object assignments which would result in creating a new object in memory and assignments of all values except the values which are volatile The NOT operation is applicable only to Boolean type Multiplication Subtraction Addition Division and Remainder is applicable only to integer types The increment and decrement work on integer types only Unary Operator Logical negation NOT NOT expression Postfix increment x Prefix increment x Postfix decrement x Prefix decrement x Relational Operators Greater then Lesser then greater then equal to lesser then equal to expression expression expression expression expression expression expression expression expression expression expression expression expression expression expression expression expression expression expression expression expression expression expression expression NOT expression Identifier expression is for inheritance of object is for composition of object E g Object Router Object Firewall Object Port Object LinuxRouter Port p Firewall a Router r1 LinuxRouter r2 r2 r1 means router r2 inherits non volatile characteristics of r1 r2 a by doing this we make firewall a part of router r2 so configuration on this device will automatically configure firewall too Operator Precedence NOT OR AND 2 6 2 Declarations 1 Object Type Declaration Declaration Object Type obj Creates a copy of the type of object in memory The object type must either be defined or should be available in library if supported 2 Object Instance Creation Declaration Type obj instancename Creates an instance by copying from original object which is used for type definition 3 Array Creation Declaration Type Identifier expr 4 Array Indexing Read Identifier expr Store Identifier expr expr Assignment Indexing is used for storing and reading from Array position If accessed position is null and error can be raised in runtime 2 6 3 Statements 1 Expression Statements Most statements are expressions Statements are executed in sequence Successful evaluation of expression completes the statements 2 Conditional Statement There are 2 conditional statements 1 if condition statement 2 if condition statement1 else statement2 The condition in above 2 statements is an evaluation of expression The statement in 1 is executed if condition is true The statement1 in 2 is executed if condition is true and statement2 is executed if condition is false The else is connected to innermost if 3 Loop Statement while statement while condition statement Condition is evaluation of an expression When the expression becomes false the loop exits Repeat Until Statement repeat statement until condition The statement is executed until condition becomes false The difference between repeat until and while statement is that in repeat until the condition check occurs after the execution of statement whereas in while it happens before execution of statement 4 Break Statement The statement break causes termination of the smallest enclosing loop statement 5 Return statement A function returns to the invoker by means of the return statement which has following forms return return expression In the first case no value is returned In the second case the value of the expression is returned to the caller of the function 2 7 Functions The form of function definition is described below function definition return type function declaration function body function declaration return type function name parameter list function body local declarations function statements function statements statement list local declarations var type identifier parameter list identifier parameter list statement list statement statement list statement expression return type var type int char Object Array Boolean String return type is the data type which will be returned by the function var type is the local variable type for the function local declarations is the list of local variables function statements consist of statement list


View Full Document

Columbia COMS W4115 - DEVice Interface Language (DEVIL)

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 DEVice Interface Language (DEVIL) 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 DEVice Interface Language (DEVIL) 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?