Input File Syntax The parser expects the input file to be divided into objects. Each object must start with the declaration:

Similar documents
Exercise: Using Numbers

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

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

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Chapter 2: Introduction to C++

Chapter 2: Basic Elements of C++

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen

M1 Computers and Data

UNIVERSAL SERIAL INTERFACE

Programming in C++ 6. Floating point data types

Today. o main function. o cout object. o Allocate space for data to be used in the program. o The data can be changed

Language Reference Manual

Short Notes of CS201

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

Week 3 Lecture 2. Types Constants and Variables

CS201 - Introduction to Programming Glossary By

Chapter-8 DATA TYPES. Introduction. Variable:

Lecture 2 Tao Wang 1

CSc Introduction to Computing

Computer System and programming in C

Python Input, output and variables. Lecture 23 COMPSCI111/111G SS 2018

INTRODUCTION 1 AND REVIEW

1 Lexical Considerations

6.096 Introduction to C++ January (IAP) 2009

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

C++ Basic Elements of COMPUTER PROGRAMMING. Special symbols include: Word symbols. Objectives. Programming. Symbols. Symbols.

JME Language Reference Manual

Main Memory Organization

VARIABLES AND CONSTANTS

Language Reference Manual simplicity

Language Reference Manual

Typescript on LLVM Language Reference Manual

CHAD Language Reference Manual

Computers Programming Course 5. Iulian Năstac

3. Java - Language Constructs I

LECTURE 02 INTRODUCTION TO C++

Programming for the Web with PHP

Java Basic Datatypees

DEPARTMENT OF MATHS, MJ COLLEGE

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

QUark Language Reference Manual

COMPUTER APPLICATION

Chapter 2 Basic Elements of C++

Presented By : Gaurav Juneja

Spoke. Language Reference Manual* CS4118 PROGRAMMING LANGUAGES AND TRANSLATORS. William Yang Wang, Chia-che Tsai, Zhou Yu, Xin Chen 2010/11/03

Introduction to string

Programming and Data Structures

Introduction to Programming Using Java (98-388)

.. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar..

Quiz Start Time: 09:34 PM Time Left 82 sec(s)

QUIZ. 1. Explain the meaning of the angle brackets in the declaration of v below:

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

C Language, Token, Keywords, Constant, variable

CS201 Latest Solved MCQs

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

ME 172. Lecture 2. Data Types and Modifier 3/7/2011. variables scanf() printf() Basic data types are. Modifiers. char int float double

Lecture 3. More About C

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

Computer System and programming in C

Princeton University. Computer Science 217: Introduction to Programming Systems. Data Types in C

Data Types Literals, Variables & Constants

Creating a C++ Program

Differentiate Between Keywords and Identifiers

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C

Lab # 02. Basic Elements of C++ _ Part1

Reserved Words and Identifiers

Lexical Considerations

X Language Definition

Computer Components. Software{ User Programs. Operating System. Hardware

As stated earlier, the declaration

BTE2313. Chapter 2: Introduction to C++ Programming

C++ Programming: From Problem Analysis to Program Design, Third Edition

Objectives. In this chapter, you will:

Preview from Notesale.co.uk Page 6 of 52

Universal Format Plug-in User s Guide. Version 10g Release 3 (10.3)

Fundamentals of Programming. Lecture 12: C Structures, Unions, Bit Manipulations and Enumerations

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

Getting started with C++ (Part 2)

PROGRAMMING FUNDAMENTALS

Variables and data types

4. Inputting data or messages to a function is called passing data to the function.

egrapher Language Reference Manual

XQ: An XML Query Language Language Reference Manual

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

بسم اهلل الرمحن الرحيم

Byte Ordering. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CS242 COMPUTER PROGRAMMING

d-file Language Reference Manual

XC Specification. 1 Lexical Conventions. 1.1 Tokens. The specification given in this document describes version 1.0 of XC.

SWEN-250 Personal SE. Introduction to C

String Computation Program

Chapter 2 Working with Data Types and Operators

Declaration and Memory

Lexical Considerations

Basic data types. Building blocks of computation

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

EL2310 Scientific Programming

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

CHAPTER-6 GETTING STARTED WITH C++

Transcription:

TCC Low Level Parser Purpose The TCC low level parser is designed to convert the low level ASCII based configuration files into a binary format which can then be downloaded to the Alpha processor boards. This parser only performs a very minimal check on the data because it assumes the high level parser has already done this. Input File Syntax The parser expects the input file to be divided into objects. Each object must start with the declaration: new Object { where Object is the type of object being declared. The end of an object definition is a line containing a single symbol. Between the pairs of brackets there must be a series of fields keyword/value pairs which are defined using the syntax: KEYWORD = value The parser program requires at least one space between the keyword, the equal sign and the value. Three data types are permitted as values. These are: String any series of non-space characters enclosed by double quotes Float any non-string value containing a decimal point Integer any non-float and non-string value These rules show how the program determines the field type. Integers and floats are evaluated using the atoi() and atof() library routines. This means that if they are passed a non-numeric value the result will be read as zero. Multiple values may be declared for a single keyword by separating them with commas. For example: KEYWORD = value1,value2,value3,value4 Is an allowable syntax, with each value potentially being of a different data type. The parser then associates each value with the given keyword.

Each object must have as its first keyword HEADER and this must contain the number of each data type which is in the object encoded into a single 32-bit word as illustrated below: Not Used Strings Floats Integers 00 03 0102 HEADER = 0x This header is compared against the actual number of each data type which are found and if there is a difference and error is generated. Further checking of parameters is performed by the relevant object parser. This is passed a list of keyword/value pairs and then performs minimal checking to ensure the object is valid. If the object is not valid and error is generated and the parser will abort.

Example An example of a possible level 2 global configuration file is given below. This file contains two types of objects, scripts and tools. HEADER = 0x010203 TYPE = 1 INDEX = 2 NAME = "Loose_Electron" DPHI = 0.3 EOPMIN = 0.8 HEADER = 0x010203 TYPE = 2 INDEX = 2 NAME = "Loose_Jet" DPHI = 0.3 DETA = 0.3 HEADER = 0x010008 TYPE = 3 INDEX = 1 NAME = "e/jet_mass" NTOOL = 2 TOOL = 1,2 TOOL = 2,2 new Script { HEADER = 0x01030c BIT = 1 NAME = "e/jet/mass_script" NTOOL = 3 TOOL = 1,2,10.0,2 TOOL = 2,2,10.0,1 TOOL = 3,1,50.0,1

Technical Implementation The class diagram for the TCC parser program is shown below with the specific classes need to interpret the Level 2 global configuration file added.

The floats and integers are all stored as 32-bit quantities in the Alpha processor byte order. Strings are stored as null terminated character arrays which are padded up to the next multiple of 4 bytes. This is to ensure that all integer and float quantities are stored on 4-byte aligned memory locations as required by the Alpha processor. The MStream class performs the conversion into binary as well as swapping the data into Alpha byte order (if needed) and padding strings to 4-byte multiples. It is written without using the STL library so that it can also be compiled on the Alpha board and used for reading in the binary data. The TCCparser class controls the input of ASCII file and checks each line for the start of a new object. When a new object is found the relevant ObjectParser class is called to read in and then check the object. Specific parsers for different input file formats inherit from the generic TCCparser class and declare specific ObjectParsers to the inherited TCCparser class. It is these ObjectParsers which are passed the object found in the input file. If no parser is found for a given object then a error will be generated. The specific object parsers all implement the virtual method check() which is passed a list of ObjectParam classes. There is one instance of this class for each object parameter found and the class stores the keyword, the value and the data type. The purpose of the check function is to ensure that the basic fields required for all objects of that type are present. If they are the routine returns true otherwise it must return false which will cause the parser to abort.