LCSL Reference Manual

Similar documents
Language Reference Manual simplicity

PYTHON- AN INNOVATION

Lexical Considerations

JME Language Reference Manual

DaMPL. Language Reference Manual. Henrique Grando

ARG! Language Reference Manual

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003

A Java program contains at least one class definition.

SCoLang - Language Reference Manual

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

LCSL Logic Circuit Simulation Language

Chapter 2 Working with Data Types and Operators

CHIL CSS HTML Integrated Language

Fundamentals of Programming

Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands

DEPARTMENT OF MATHS, MJ COLLEGE

Standard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points)

Work relative to other classes

MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards

1 Lexical Considerations

SECTION II: LANGUAGE BASICS

MACHINE LEVEL REPRESENTATION OF DATA

UNIT- 3 Introduction to C++

COMP2611: Computer Organization. Data Representation

FRAC: Language Reference Manual

L-System Fractal Generator: Language Reference Manual

Java Notes. 10th ICSE. Saravanan Ganesh

Typescript on LLVM Language Reference Manual

The Warhol Language Reference Manual

Guide for The C Programming Language Chapter 1. Q1. Explain the structure of a C program Answer: Structure of the C program is shown below:

Lexical Considerations

Engineering Computing I

Computer System and programming in C

These are reserved words of the C language. For example int, float, if, else, for, while etc.

Advanced Algorithms and Computational Models (module A)

Chapter 2. Lexical Elements & Operators

ECE Digital System Design & Synthesis Exercise 1 - Logic Values, Data Types & Operators - With Answers

Chapter 3: Operators, Expressions and Type Conversion

Sir Muhammad Naveed. Arslan Ahmed Shaad ( ) Muhammad Bilal ( )

BINARY SYSTEM. Binary system is used in digital systems because it is:

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

BASIC ELEMENTS OF A COMPUTER PROGRAM

I Internal Examination Sept Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs.

Lecture 3. More About C

World Inside a Computer is Binary

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Variable and Data Type I

SSOL Language Reference Manual

ENGR 101 Engineering Design Workshop

Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Overview of C. Basic Data Types Constants Variables Identifiers Keywords Basic I/O

COMP Primitive and Class Types. Yi Hong May 14, 2015

SMURF Language Reference Manual Serial MUsic Represented as Functions

Chapter 12 Variables and Operators

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

VARIABLES AND CONSTANTS

Number Systems CHAPTER Positional Number Systems

IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010

3. Java - Language Constructs I

GBIL: Generic Binary Instrumentation Language. Language Reference Manual. By: Andrew Calvano. COMS W4115 Fall 2015 CVN

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab.

Chapter 2: Using Data

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

PART I. Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++.

Sprite an animation manipulation language Language Reference Manual

Data types Expressions Variables Assignment. COMP1400 Week 2

VARIABLES & ASSIGNMENTS

Chapter 4: Making Decisions. Copyright 2012 Pearson Education, Inc. Sunday, September 7, 14

Reserved Words and Identifiers

Number Systems, Scalar Types, and Input and Output

Programming I Lecture 7

Topic Notes: Bits and Bytes and Numbers

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

Babu Madhav Institute of Information Technology, UTU 2015

The Arithmetic Operators

cast int( x float( x str( x hex( int string int oct( int string int bin( int string int chr( int int ord( ch

Flow Language Reference Manual

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

Contents. Appendix D Verilog Summary Page 1 of 16

VLC : Language Reference Manual

Fundamental of Programming (C)

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

JAVA Programming Fundamentals

YOLOP Language Reference Manual

Declaration and Memory

By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program

Topic Notes: Bits and Bytes and Numbers

Arithmetic Processing

CHW 261: Logic Design

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

Operators in java Operator operands.

Inf2C - Computer Systems Lecture 2 Data Representation

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

IC Language Specification

Briefly describe the purpose of the lexical and syntax analysis phases in a compiler.

Angela Z: A Language that facilitate the Matrix wise operations Language Reference Manual

CS4120/4121/5120/5121 Spring 2016 Xi Language Specification Cornell University Version of May 11, 2016

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

Transcription:

LCSL Reference Manual Sachin Nene, Chaue Shen, Bogdan Caprita, Julian Maller

1.1 Lexical Conventions 1.1.1 Comments Comments begin with (* and end with *) 1.1.2 Variables Variables consist solely of alphanumeric characters and underscores. The first character must always be an uppercase letter (A-Z) and the last character can never be an underscore ( _ ). 1.1.3 Keywords All keywords start with lowercase letters in order to avoid any overlap with variable names: true false fileloc comp end component if then else ef head tail length width 1.1.4 Operators Operators in LCSL include:. @! ~ ** * / % + - << >> < > <= >= # :: ++ \ & ^ &&? : <- 1.2 Types 1.2.1 Fundamental Data Types The following list includes all fundamental data types in LCSL: Integers- arbitrary precision and can be expressed in decimal, binary, octal, and hex form Floats- differentiated with integers by using decimal point; can also have exponent using e Booleans- take on keyword values true or false 1.2.2 Lists and Strings Lists are data structures consisting of fundamental or more complex data types (including other lists). The elements of a list are separated by whitespace and enclosed within [ and ]. Strings are implemented in LCSL as lists of ASCII-encoded integers. 1.2.3 Components Components are similar to functions in other languages that can pass into and return from other components. This is a primary feature of LCSL and is a characteristic of it s functional programming nature. Components can either be declared without a name and using the comp and end keywords, or they can be declared with a name using the component keyword. Parameters passed to and from a component are known as ports. The ports of a component are preceded with either a + or - which mean an input or output port respectively. The inputs must be introduced before any output port. 1.2.4 Systems

Systems represent an actual instance of a component. A variable becomes a System type when it is connected to an instance of a component with specific input and output port values given. 1.2.5 Vectors Vectors are similar to bit-vectors in hardware design languages and consist of basic logical bit values (0 and 1). Vectors are created in two different ways. First, the vector can be created through conversion of an integer using the VectorConst component. Vectors can also be created by writing them directly between single quotes and connecting this string to a Vector variable. All operations involving vectors must use two vectors with the exact same width. 1.3 Type Operators 1.3.1 Integer Operators The following is a table for operations of integers. Operator - X bitwise negation X ** Y power X * Y multiplication X / Y division X % Y modulo X + Y addition X Y subtraction X << Y shift left X >> Y shift right X < Y less than X > Y greater than X <= Y less than or equal X >= Y greater than or equal X == Y equal X!= Y not equal X & Y bitwise AND X ^ Y bitwise XOR X Y bitwise OR 1.3.2 Float Operators The following is a table for operations of floats. Operator X ** Y X * Y X / Y X + Y X Y X < Y X > Y X <= Y X >= Y X == Y X!= Y power multiplication division addition subtraction less than greater than less than or equal greater than or equal equal not equal 1.3.3 Boolean Operators The following is a table for operations of Booleans.

Operator! X logical NOT X && Y short circuit logical AND X Y short circuit logical OR X? expr1 : expr2 conditional 1.3.4 List Operators The following is a table for operations of lists. Operator length X X # <int> <elements> :: [] X ++ Y X \ Y list length repeated list concatenation (<int> times) list construction list concatenation list concatenation with new-line 1.3.5 Vector Operators The following is a table for operations of vectors. Operator X <intlist> bit selection ~ X bitwise negation width X vector width msb X most significant bit msbs X all bits except LSB lsb X less significant bit lsbs X all bits except MSB X * Y unsigned multiplication X *+ Y signed multiplication X + Y addition X Y subtraction X << <int> shift left X >> <int> shift right X < Y unsigned less than X > Y unsigned greater than X <= Y unsigned less than or equal X >= Y unsigned greater than or equal X <+ Y signed less than X >+ Y signed greater than X <=+ Y signed less than or equal X >=+ Y signed greater than or equal X # <int> repeated vector concatenation X ++ Y vector concatenation X == Y equal 1.4 Expressions 1.4.1 Expression Syntax Expressions in LSCL are based on the conceptual notion of source expressions and sink expressions. Source expressions produce values whereas sink expressions consume values.. 1.4.2 Basic Expressions

1.4.2.1 Constants Constants are the most fundamental of values and can be of any of the fundamental data type forms (integer, float, Boolean). 1.4.2.2 Variables Variables are bounded to a specific (possibly dynamic) value based on another expression. 1.4.2.3 Connections Connections bound variables to other expressions using the <- operation. 1.4.2.4 Instantiations Instantiations create instances of components with certain input and output port values based on other expressions. 1.4.2.5 Conditionals Expression conditionals use the <predicate>? <expr1> : <expr2> where <predicate> is a source expression. The expression returns <expr1> if <predicate> is true and <expr2> if it is false. 1.4.2.6 Operational expressions Depending on the data type of the value of variables and sub-expressions used, there are several operations that create expressions. Short circuit logical AND (&&) and OR ( ) can be used with several subexpressions. The prefix unary operator! and infix binary operators like + are also ways to create expressions. 1.4.3 Source Expressions As mentioned above, source expressions produce values. The following are valid source expressions: Variables Constants (integer, Boolean, or float) Lists Connections Instantiations Conditionals Anonymous component definitions Operational expressions expression groupings of any combination of above 1.4.3 Sink Expressions As mentioned above, sink expressions consume values. The following are valid sink expressions: Variables Instantiations Connections 1.5 Statements 1.5.1 Component Definitions Component definitions both define a component and bound it to a variable (the component name) using the component keyword. Anonymous component definitions use the comp keyword and are not necessarily bounded to any variable. For instance, a normal component looks like the following: component True +X X

X? X <- true : X <- false end 1.5.2 Connections Connections using the <-, defined above as a type of expression, are also simple statements. 1.5.3 Conditionals Conditionals as statements provide the same functionality as if they were basic expressions but also provide extra functionality through the else and ef keywords. For instance: if (<predicate>) (* other statements *) ef (<otherpredicate>) (* even more statements *) else (* default statements *) end 1.6 Syntax Grammar statements: statements statement statement: ifelse component_named instantiation_system connection ifelse: "if" expression ifelse_then statements ifelse_else "if" expression ifelse_then namespace_sugar ifelse_else ifelse_then: "then" ifelse_else: "end" "else" statements "end" "else" namespace_sugar "end" "ef" expression ifelse_then statements ifelse_else "ef" expression ifelse_then namespace_sugar ifelse_else component_named: "component" name component_inputs component_outputs statements "end" "component" name component_inputs component_outputs "end" component_inputs: component_inputs component_inputs "+" name component_outputs:

component_outputs component_outputs "-" name STRING: " " ( ("a.. z ) ("A".. "Z") ("0".. "9") "_" INTEGERorVECTOR: digits 0x + digits 1x + digits 0b + digits 1b + digits digits: ("0.. 9")+ exponent: E digits FLOAT: (digits)* "." (digits)* (exponent)? expression: "{" expression ")" STRING INTEGERorVECTOR FLOAT "true" "false" "[]" "fileloc" name "[" list_sugar_items "]" "import" STRING component_anonymous instantiation_system connection expression "." expression expression "@" expression expression "&&" expression expression " " expression expression "?" expression ":" expression prefix_operator expression expression infix_operator expression name: NAME "`" prefix_operator "`" infix_operator prefix_operator: (all prefix operations listed in data type operation tables in 1.3) infix_operator: (all infix operations listed in data type operation tables in 1.3) component_anonymous:

"comp" component_inputs component_outputs statements "end" "comp" component_inputs component_outputs namespace_sugar "end" instantiation_system: "{" expression "}" "{" expression "," port_expressions "}" "{" expression "," port_expressions "," port_expressions "}" port_expressions: port_expressions expression port_expressions "_" connection: expression "<-" expression