Template Language and Syntax Reference

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

SFPL Reference Manual

1 Lexical Considerations

DINO. Language Reference Manual. Author: Manu Jain

Typescript on LLVM Language Reference Manual

Programming Languages & Translators. XML Document Manipulation Language (XDML) Language Reference Manual

Mirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006

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

d-file Language Reference Manual

Lexical Considerations

COMS W4115 Programming Languages & Translators FALL2008. Reference Manual. VideO Processing Language (VOPL) Oct.19 th, 2008

The PCAT Programming Language Reference Manual

Unit 3. Operators. School of Science and Technology INTRODUCTION

Chapter 2, Part III Arithmetic Operators and Decision Making

ARG! Language Reference Manual

DaMPL. Language Reference Manual. Henrique Grando

Lexical Considerations

2. λ is a regular expression and denotes the set {λ} 4. If r and s are regular expressions denoting the languages R and S, respectively

A simple syntax-directed

JME Language Reference Manual

Sketchpad Graphics Language Reference Manual. Zhongyu Wang, zw2259 Yichen Liu, yl2904 Yan Peng, yp2321

MR Language Reference Manual. Siyang Dai (sd2694) Jinxiong Tan (jt2649) Zhi Zhang (zz2219) Zeyang Yu (zy2156) Shuai Yuan (sy2420)

The Warhol Language Reference Manual

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

The SPL Programming Language Reference Manual

XQ: An XML Query Language Language Reference Manual

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

UNIT- 3 Introduction to C++

Control Structures. CIS 118 Intro to LINUX

IT 374 C# and Applications/ IT695 C# Data Structures

GAWK Language Reference Manual

Programming for Engineers Introduction to C

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

EZ- ASCII: Language Reference Manual

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

DEMO A Language for Practice Implementation Comp 506, Spring 2018

Sprite an animation manipulation language Language Reference Manual

Full file at

A Simple Syntax-Directed Translator

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

Language Reference Manual simplicity

Lecture 3 Tao Wang 1

Chapter 2. Lexical Elements & Operators

Petros: A Multi-purpose Text File Manipulation Language

CLIP - A Crytographic Language with Irritating Parentheses

Java+- Language Reference Manual

Unit-II Programming and Problem Solving (BE1/4 CSE-2)

Learning Language. Reference Manual. George Liao (gkl2104) Joseanibal Colon Ramos (jc2373) Stephen Robinson (sar2120) Huabiao Xu(hx2104)

EasyQL Language Reference Manual

WarmFusion Reference Manual

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

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

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

GraphQuil Language Reference Manual COMS W4115

FRAC: Language Reference Manual

CHIL CSS HTML Integrated Language

String Computation Program

VLC : Language Reference Manual

VENTURE. Section 1. Lexical Elements. 1.1 Identifiers. 1.2 Keywords. 1.3 Literals

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

QUark Language Reference Manual

MELODY. Language Reference Manual. Music Programming Language

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

Projects for Compilers

2.2 Syntax Definition

Decaf Language Reference Manual

Full file at

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

Creating a C++ Program

Language Reference Manual

YOLOP Language Reference Manual

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

SOURCE LANGUAGE DESCRIPTION

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */

Examples of attributes: values of evaluated subtrees, type information, source file coordinates,

CS /534 Compiler Construction University of Massachusetts Lowell. NOTHING: A Language for Practice Implementation

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

corgi Language Reference Manual COMS W4115

Information Science 1

ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 1 IDL Operators

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

ASML Language Reference Manual

Lecture 3. More About C

HAWK Language Reference Manual

Title:[ Variables Comparison Operators If Else Statements ]

Program Fundamentals

Chapter Overview. C++ Basics. Variables and Assignments. Variables and Assignments. Keywords. Identifiers. 2.1 Variables and Assignments

C: How to Program. Week /Mar/05

Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan

Reference Grammar Meta-notation: hfooi means foo is a nonterminal. foo (in bold font) means that foo is a terminal i.e., a token or a part of a token.

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

SMURF Language Reference Manual Serial MUsic Represented as Functions

BoredGames Language Reference Manual A Language for Board Games. Brandon Kessler (bpk2107) and Kristen Wise (kew2132)

Overview of C, Part 2. CSE 130: Introduction to Programming in C Stony Brook University

INTRODUCTION 1 AND REVIEW

DEPARTMENT OF MATHS, MJ COLLEGE

Chapter 2. C++ Basics. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Computer System and programming in C

Transcription:

APPENDIX B This chapter describes the language and syntax conventions used in the VPN Solutions Center template implementation. Grammar and Syntax The Extensible Markup Language (XML) template definition section consists of a sequence of IOS command lines, a sequence of control statements and some template comments. This section describes in detail the template language grammar and syntax. For specifying the syntax of the template language, Cisco used a widely-used notation, called context-free grammars (Bachus-Naur Format). For specifying the semantics of the template language, we use informal descriptions and examples. Argument argument variable = variable variable = constant variable = array_variable variable = IOS_command Argument List argument_list argument argument_list, argument Array Variable array_variable variable[index] array_variable[index] Constant constant num float quoted_string B-1

Grammar and Syntax Appendix B Expression expression term (expression) expression relational_opr expression expression logical_opr expression expression additive_opr expression expression multiplicative_opr expression Index index variable num IOS Command Expression IOS_command_expression IOS_command expression IOS_command_expression expression IOS_command_expression IOS_command Repeat Counter Variable repeat_counter_variable $(letter digit)* Repeat Variable repeat_variable variable num array_variable Statement statement IOS_command_expression IOS_comment Template_comment {statement_list } #if ( expression ) statement #if ( expression ) statement #else statement #repeat ( repeat_variable, repeat_counter_variable ) statement Statement List statement_list statement statement_list statement Template template statement_list B-2

Appendix B Lexical Conventions Template Variable template_variable variable ( argument_list ) variable ( ) Term term variable constant array_variable template_variable Variable variable $(letter digit)* Lexical Conventions This section summarizes the lexical conventions and the notations used in the VPN Solutions Center template grammar: Tokens Template Comments There are six classes of tokens: IOS commands, variables, keywords, constants, operators and other separators. Blanks, tabs, new lines and comments (collectively referred to as white space ) as described below are ignored except when they separate tokens. Some white space is required to separate otherwise adjacent keywords and constants. Template comments are indicated by // ; everything after the comment indicator is treated as a template comment. Template comments are not included in the template configuration file they are discarded during the template generation process. Token Variables A token variable is a sequence of letters and digits. The first character must be a letter $ ; it is followed by letters or digits: letter a z, A Z digit 0 9 Upper and lowercase letters are treated as being different. Variables can be up to 32 characters in length. B-3

Lexical Conventions Appendix B Keywords Keywords are reserved and appear in boldface. The following keywords are reserved and cannot be used in any other context: Table B-1 Template Keywords #and #else #eq #ge #gt #if #le #lt #ne #or #repeat Constants There are several kinds of constants, as described below: A Token num constant consists of a sequence of digits: num digit digit* A Token float constant consists of three parts: integer, a decimal point, and a fraction. The integer and fraction parts both consist of a sequence of digits: float num.num A Token quoted_string is a sequence of characters surrounded by double quotes, as in.. Expressions The expressions used in VPN Solutions Center templates are as follows: IOS commands, variables Array_variables Template_variables Constants Expressions in parentheses The precedence of an expression operator is the same as the order that the expressions are documented in this section (that is, multiplicative operators first, followed by additive operators, and so on), with the highest precedence first. 1. Multiplicative Operators The operators include * and /, which group left-to-right. The operands of * and / must be of arithmetic type. The binary * operator denotes multiplication. The binary / operator yields the quotient of the division of the first operand by the second. 2. Additive Operators The operators include + and, which group left-to-right. The result of the + operator is the sum of the operands. The result of the operator is the difference of the operands. B-4

Appendix B Lexical Conventions 3. Relational Operators The relational operators group left-to-right. The operators are: #lt (less than) #gt (greater than #le (less than or equal to) #ge (greater than or equal to) #eq (equal to) #ne (not equal to) All of the relational operators yield 0 if the specified relation is false, and yield 1 if it is true. The type of the result is an integer. 4. Logical Operators The logical operators group left-to-right. They are as follows: #or The #or operator returns 1 if both its operands compare unequal to zero, and 0 otherwise. #and The #and operator returns 1 if either of its operands compare equal to zero, and 0 otherwise. The operands need to be the same arithmetic type and the result is an integer. 5. Array Operators The array operators are as follows: One-dimensional operator: [a] Two-dimensional operator: [a] [b] Statements Except when described otherwise, statements are executed and output in sequence. Statements are executed for their effect and they do not have values. They fall into the following several groups: IOS Command Expression Statement Most statements in the template are IOS command expression statements, which are Cisco IOS router commands. Compound Statement A compound statement (also called a block ) is used so that several statements can be used where one is expected. Selection Statements The selection statements have two forms. In both forms of the #if statement, the expression, which must be an arithmetic type, is evaluated. If it compares unequal to 0, the first substatement is executed. In the second form, if the expression is 0, the second (#else) substatement is executed. B-5

Lexical Conventions Appendix B Iteration Statement The iteration (repeat) statement specifies a looping operation. Depending on how many values are specified for the repeat variable, the #repeat statement executes the substatement as many times as there are values defined for the variable. For example, the following repeat statement would cause the access-list substatement to repeat as many times as there are values specified for the ACL (one-dimensional) variable. The $i specified is the repeat counter variable. This repeat counter variable is set to 0 initially; the repeat counter is incremented by 1 for each iteration of the statement.! #repeat ($ACL, $i) { access-list $ACL[$i] permit ip $Source_IP_Address[$i] $Source_Mask[$i] $Dest_IP_Address[$i] $Dest_Mask[$i] precedence 7 } The $i specified in the repeat statement is the counter for the repeat statement. This counter variable is set to 0 initially; the counter is incremented by 1 for each iteration of the statement. For example, the repeat statement in the example above would cause the access-list substatement to repeat as many times as there are values specified for the ACL (one-dimensional) variable. This produces in the template configuration file one line for each iteration. The $i specified in the variables declared in the substatements indicates that it is a one-dimensional variable. For example, for each value specified for the Source_IP_Address variable, the template substitutes one value for Source_IP_Address. B-6