1 FAST VECTOR PROCESSING LANGUAGE LANGUAGE REFERENCE MANUAL Gowri Kanugovi <[email protected]> Pratap V Prabhu <[email protected]> Ravindra Babu Ganapathi <[email protected]>2 TABLE OF CONTENTS 1. Introduction........................................................................................................................... 3 2. Lexical Conventions.......................................................................................................... 3 2.1. Comments...................................................................................................................... 3 2.2. Identifiers....................................................................................................................... 3 2.3. Keywords....................................................................................................................... 3 2.4. Constants ....................................................................................................................... 4 2.5. Operators....................................................................................................................... 4 2.6. Separators...................................................................................................................... 5 2.7. Block delimitation......................................................................................................... 5 2.8. Scoping........................................................................................................................... 6 3. Data Types............................................................................................................................. 6 3.1. Basic Type...................................................................................................................... 6 4. Branching Construct ............................................................................................................ 6 5. Looping Construct................................................................................................................ 7 6. Declarations........................................................................................................................... 7 7. Functions................................................................................................................................ 7 8. Example program ................................................................................................................. 8 9. Lexer....................................................................................................................................... 8 10. Grammar.............................................................................................................................. 103 1. Introduction Fast Vector Processing Language (FVPL) allows programmers to transparently and efficiently utilize the power of SIMD instructions (such as SSE, SSE2) to compute large amount of sequential data at higher speeds. Manipulation of large sequential data is common in various domains like image processing, databases and cryptography, but most of the current C/C++ compilers generate slow native code for x86 family of processors. The new processors include a vector processing unit which has the capability to compute data in parallel. These instructions known as SIMD (Single Instruction Multiple Data) operate on 128 bits of data at a time. FVPL aims to make use of the power of the new generation processors. 2. Lexical Conventions FVPL comprises tokens such as: keywords, identifiers, comments, integer constants, floating point constants, operators and separators. It is a free form language; spaces, tabs and new lines are ignored and considered to only serve as delimiters between tokens. 2.1. Comments Single line comments in FVPL are begin with the characters // like in the C-language. Multi-line comments are also supported by FVPL. Such comments begin with /* and should be terminated by */ 2.2. Identifiers Identifiers are sequence of letters, digits and the underscore (‘_’) character. The first letter however has to be only either an alphabet or the underscore character. Identifiers cannot begin with a digit. FVPL identifiers are case-sensitive. Following are some examples of FVPL identifiers Valid identifiers: A, foo, a, _bar, bar_foo, count2 Invalid identifiers: 1A, a#, foo-bar 2.3. Keywords The following table summarizes the identifiers used as keywords in FVPL. These keywords cannot be used as otherwise. int Float double dynamic main for dynamic void return sizeof static int8 if else4 2.4. Constants Constants provide programmers the ease of initializing any of their identifiers to one of the supported primitives. The different types of constants supported by FVPL are: 2.4.1. Integer constants: Integers of FVPL consists of an optional ‘+’ or ‘-‘ sign followed by any number of digits in the range of 0-9. 2.4.2. Floating point constants: Floating point numbers in FVPL comprises of an optional ‘+’ or ‘-‘ sign followed by an integer of one or more digits. This is followed by a decimal point which is then followed by an integer of one or more digits. 2.5. Operators FVPL supports operations on both scalars and vectors. 2.5.1. Operators on Scalars: A programmer can perform the following actions on a scalar type in FVPL: • Arithmetic operators: The operators ‘+, ‘-‘, ‘*’ and ‘/’ are supported by FVPL. The semantics of the operators are similar to those of addition, subtraction, multiplication and division respectively. The multiplication and division operators are however supported only for the int and float data types in FVPL. The precedence and associativity of operators follows the same conventions as in the C-language. • Bitwise logical operators: FVPL supports bitwise logical AND, OR, XOR and NOT operations. These are denoted by ‘&’, ‘|’, ‘^’ and ‘~’ respectively. • Assignment operators: The assignment operator in FVPL is denoted the ‘=’ symbol. This operator assigns the value of the right hand side expression to the left hand side expression. • Sizeof operator: The sizeof operator returns the size of the operand in bytes. The result is an integer
View Full Document