Unformatted text preview:

ACL Automated Command Line Cheow Lip Goh Paul December 18 2006 1 Contents CONTENTS 2 CHAPTER 1 INTRODUCTION TO ACL 4 1 1 DESIGN OF ACL 4 1 1 1 Very Simple and Familiar Syntax and Semantics 4 1 1 2 Cross Platform Compatibility 4 1 1 3 ACL is Interpreted 4 CHAPTER 2 TUTORIAL 5 2 1 RUNNING THE ACL PROGRAM 5 2 2 A SIMPLE EXAMPLE 5 CHAPTER 3 LANGUAGE REFERENCE MANUAL 8 3 1 LEXICAL CONVENTIONS 8 3 1 1 Comments 8 3 1 2 Identifiers 8 3 1 3 Keywords 8 3 1 4 Constants 8 3 1 4 1 Integer Constants 8 3 1 4 2 String Constants 9 3 1 5 Other Tokens 9 3 2 EXPRESSIONS 9 3 2 1 Primary Expressions 9 3 2 1 1 Identifiers 9 3 2 1 2 Constants 9 3 2 1 3 Parenthesized Expressions 9 3 2 2 Arithmetic Expressions 10 3 2 2 1 Binary Operators 10 3 2 3 Relational Expressions 10 3 2 4 Assignment Expressions 10 3 3 STATEMENTS 11 3 3 1 Expression Statement 11 3 3 2 Compound Statement 11 3 3 3 Conditional Statement 11 3 3 4 While Statement 11 3 3 5 For Statement 12 3 3 6 Break Statement 12 3 3 7 Continue Statement 12 3 3 8 Return Statement 12 3 4 FUNCTION DEFINITION 13 3 5 BUILT IN FUNCTIONS 13 3 5 1 Session Function 13 3 5 2 Receive Function 13 3 5 3 Send Function 14 CHAPTER 4 PROJECT PLAN 15 4 1 PROJECT PLANNING PROCESS 15 4 2 PROGRAMMING STYLE GUIDE 15 4 2 1 Antlr Coding Style 16 4 2 2 Java Coding Style 16 4 3 PROJECT TIMELINE 17 2 4 4 SOFTWARE DEVELOPMENT ENVIRONMENT 17 4 5 PROJECT LOG 17 CHAPTER 5 ARCHITECTURAL DESIGN 18 CHAPTER 6 TEST PLAN 20 6 1 AUTOMATED REGRESSION TESTS 20 6 2 MANUAL DETAILED TESTS ON SPECIFIC AREAS OF THE COMPILER 25 6 3 MANUAL TESTS ON THE BUILT IN FUNCTIONS 25 CHAPTER 7 LESSONS LEARNED 26 APPENDIX A CODE LISTING 27 3 Chapter 1 Introduction to ACL ACL Automated Command Line is an interpreted language designed to automated repetitive tasks on the command line The interpreter will be based on Java mainly because existing implementation of Expect suffers from the problems of C where you need a separate interpreter for every OS Using Java will ensure that the interpreter is useful regardless of the OS used and be able to run it whenever a JVM for the OS exist 1 1 Design of ACL In the next few subsections a list of desirable language features of ACL will be described 1 1 1 Very Simple and Familiar Syntax and Semantics ACL is designed to be very similar to the syntax and semantics of C Java making it a very easy and intuitive language to pick up for most people One major difference that ACL has from C Java is that the variables of ACL don t have to be pre defined like in C Java but rather the variable will come into existence the moment you assign a value to it much like what common scripting languages like Tcl tk or Python does 1 1 2 Cross Platform Compatibility ACL will be able to run whenever there is a java virtual machine However as of this writing ACL only works with linux and does not work with Windows Although much effort has been expanded to make ACL work under Windows it seems that the Java classes that interact with the spawned process in Windows is very platform specific and currently does not work very well 1 1 3 ACL is Interpreted ACL is interpreted to enable a programmer to test the code without the compilation process 4 Chapter 2 Tutorial 2 1 Running the ACL Program After the source code of the ACL program is written it is very easy to run the program Under linux the following command would run ACL java cp path to antlr installation antlr jar path to ACL installation AclMain f acl source file A concrete example would be java cp home paulgoh antlr 2 7 6 antlr jar home paulgoh ACL AclMain f test acl 2 2 A Simple Example In our simple example we define a function called telnet login which when supplied with the server user and password will login to a server Later we invoke the telnet login function and send some command after logging in Here is the example Our first ACL example Definition of the telnet login function to login to a certain server Arguments server name or ip address of the server user username of the user logging in password password of the user logging in function telnet login server user password Open a telnet session to the server session telnet server Wait for the login prompt receive login Send the username send user Wait for the password prompt receive word Send the password send password 5 Definitions of variables user paulgoh password secret server localhost prompt Call the telnet login function passing in the appropriate variables telnet login server user password Wait for the shell prompt receive prompt Send an ls command to list the content of the home directory send ls Let s take a detailed look at the code ACL takes the standard C Java style comments i e A comment or A comment The simple example is sprinkled with comments that explain very clearly what each section of the ACL code is doing To define a function in ACL one has to use the function keyword and supply a function name i e telnet login together with a comma delimited list of variables The function body contains the code to be executed when the function is invoked ACL has 3 built in functions namely session receive and send The session function takes a command in the form of a string that will spawn a new login session In our example a telnet session was spawned using telnet server The concatenates two strings together If the concatenation is between a number and a string i e abc 1 the end result is the string abc 1 The receive function takes a string to wait for and when the string is found in the spawned session receive will return The send function sends a command specified by the string passed into it to the spawned session Together these 3 built in functions will interact with the spawned login session 6 Assigning a value to a variable will bring the variable into existence in ACL i e a 1 b a string These two lines of code will create a variable called a which has a type of integer with a value of 1 and also another variable called b which has a type of string with a value of a string Strings in ACL are surrounded by double quotes As you can see the variables come into existence in ACL simply by assigning values to it and the type of the variables are implicit depending on whether the value assigned to it is surrounded by double …


View Full Document

Columbia COMS W4115 - ACL - Automated Command Line

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 ACL - Automated Command Line 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 ACL - Automated Command Line 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?