Soar Command Line Interface Soar 8.6 Jonathan Voigt University of Michigan Soar Workshop 25.

Slides:



Advertisements
Similar presentations
Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
Advertisements

1 The Shell and some useful administrative Unix Commands How Unix works along with some additional, useful administrative Unix commands you might need.
Tcl and Otcl Tutorial Part I Internet Computing KUT Youn-Hee Han.
CMT Programming Software Applications
Jonathan Voigt University of Michigan Soar Workshop 25
Thinking inside the box 26 June 2003 Soar Workshop - Slide 1 © 2003 Soar Technology, Inc. Thinking… …inside the box SoarDoc Presented on Thursday, 26 June.
A New Soar Debugger in Java Douglas Pearson ThreePenny Software
C# Programming: From Problem Analysis to Program Design1 2 Your First C# Program.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
A New Soar Debugger In Java Douglas Pearson
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Creating a Console Application with Visual Studio
C++ Functions. 2 Agenda What is a function? What is a function? Types of C++ functions: Types of C++ functions: Standard functions Standard functions.
1 The Shell and some useful administrative Unix Commands How Unix works along with some additional, useful administrative Unix commands you might need.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 19 - The Preprocessor Outline 19.1 Introduction 19.2 The #include Preprocessor Directive 19.3.
Windows Programming Lecture 05. Preprocessor Preprocessor Directives Preprocessor directives are instructions for compiler.
Introduction to Shell Script Programming
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
Designing For Testability. Incorporate design features that facilitate testing Include features to: –Support test automation at all levels (unit, integration,
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
chap13 Chapter 13 Programming in the Large.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
General Programming Introduction to Computing Science and Programming I.
Putting together a complete system Chapter 10. Overview  Design a modest but complete system  A collection of objects work together to solve a problem.
CIS 218 Advanced UNIX1 CIS 218 – Advanced UNIX (g)awk.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
Creating your first C++ program
Programming With C.
1 JavaScript in Context. Server-Side Programming.
Axel Naumann University of Nijmegen / NIKHEF, NL ROOT 2004 Users Workshop The Future of THtml Plans and Status of ROOT’s documentation facility.
Linux+ Guide to Linux Certification, Third Edition
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Chapter 0 Getting Started. Objectives Understand the basic structure of a C++ program including: – Comments – Preprocessor instructions – Main function.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
Shell Advanced Features. Module 8 Shell Advanced Features ♦ Introduction In Linux systems, the shells are often referred to as command line interfaces.
The Software Development Process
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
CMSC 1041 Introduction to C Creating your first C program.
Lecture 7 February 24, Javadoc version and author Tags These go in the comments before named classes. –Put your SS# on a separate line from the.
Creating PHP Pages Chapter 5 PHP Structure and Syntax.
Refactoring Agile Development Project. Lecture roadmap Refactoring Some issues to address when coding.
The Preprocessor Directives Introduction Preprocessing – Occurs before program compiled Inclusion of external files Definition of symbolic constants.
Introduction to Bash Shell. What is Shell? The shell is a command interpreter. It is the layer between the operating system kernel and the user.
FUNCTIONS. Midterm questions (1-10) review 1. Every line in a C program should end with a semicolon. 2. In C language lowercase letters are significant.
1 Digital Signatures – A Global Challenge Joachim Lingner Software Engineer Sun Microsystems 1.
Introduction to C Topics Compilation Using the gcc Compiler
Introduction to Computing Science and Programming I
COSC 1306 COMPUTER SCIENCE AND PROGRAMMING
Chapter 13 - The Preprocessor
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introduction to C Topics Compilation Using the gcc Compiler
C# Programming: From Problem Analysis to Program Design
Introduction to Python
Advanced Programming Lecture 02: Introduction to C# Apps
1. Open Visual Studio 2008.
Creating your first C program
Introduction to Computer Science
Module 4 Command Line Skills
Computer Programming-1 CSC 111
Presentation transcript:

Soar Command Line Interface Soar 8.6 Jonathan Voigt University of Michigan Soar Workshop 25

Problems with 8.5’s Command Line Soar 8.5’s command line syntax –Sometimes undefined –Occasionally inconsistent –Difficult for new users Tcl legacy –Although the Soar C interface is independent of Tcl, the same is not true for all of the commands Some commands implemented in the TSI or wrapped by the TSI for full functionality Some “Soar” commands are Tcl commands –source Order of options & arguments –Often important when it could be irrelevant Client-side implementation

A Solution: The Soar 8.6 Command Line Interface (CLI) Module Managed by KernelSML (server-side) Communicates with kernel using gSKI –EvilBackDoor (EBD) used for required features incomplete or unimplemented in gSKI Implements a revised command syntax KernelSML CLI gSKI Soar Kernel EBD …

Soar 8.6 CLI Syntax Goals Consistency –Use the same syntax patterns across the space of commands –Easy to learn Flexibility –Many different ways to do the same thing Legacy –Familiarity to existing Soar users

Syntax Changes New syntax based on GNU GetOpt –Part of GNU C library Widely used for command line option and argument processing Open source strikes back: GetOpt code taken and modified for use in Soar 8.6 CLI

Soar 8.6 Arguments Argument: An element of the command line separated by white space Command name: The first argument White space inside quotes, braces and parenthesis ignored 4 arguments: watch -l 2 –r 2 arguments: sp {hello-world (state ^type state) --> (write |Hello World|) (halt) }

Soar 8.6 Options Short options: Arguments prefixed by a single dash Short options may be combined with one dash Long options: Arguments prefixed by two dashes -c, -O, -cPp --chunks, --disable Three options!

Soar 8.6 Option Arguments Option argument: An argument immediately following an option that takes an argument Option arguments may be optional –Optional option arguments cannot start with a dash! 4 is the option argument: watch --level 4 “removes” is the option argument watch-wmes --add-filter -t removes S3 * *

CLI The Life of a Command Line DoCommandLine() Tokenize() DoCommandInternal() ParseX() DoX() AppKernelSML

DoCommandLine() Called from KernelSML –Part of the exposed interface Handles logging –Top-level –Command line is ‘pure’ Handles communication with KernelSML –Marshals XML command result

Tokenize() First stage of parsing Splits command line into a vector of arguments –Splits using spaces, preserving spaces between braces, parenthesis and quotes Removes comments –Pound sign (#) comments often found inside Soar files

Tokenize Algorithm 1.Trim white space and comments from command line 2.Loop until break or error: a.Remove leading white space b.If command line is empty, break c.Increment argument count d.Save everything up to next white space or the end of the line into argument i.Ignore white space between quotes, brackets, and parenthesis, check for unmatched characters ii.Remove characters from command line as they are added to argument e.Store the argument in to a vector of strings

DoCommandInternal() Help –Looks for help options on the line –Calls help command if found Aliases –If command name is an alias, substitutions are performed on the argument vector Partial matches –If command name is not an alias, it is checked against all commands to see if there is a match –Substitutes matched command name if found watch –help excise -h x -a excise –a d run –d 1 exci excise

ParseX() Parsing separated from processing –Easier to maintain Parses the data required to process the command out of the argument vector –Options and option arguments in all commands parsed out using GetOpt –Remaining arguments dealt with according to command syntax All ParseX() function signatures are the same ParseWatch(gSKI::IAgent* pAgent, std::vector & argv)

Option Ordering No processing is done until command is parsed –An exception: add-wme (WME parsed by EvilBackDoor) Options can be in any order –Options processed left to right –If options conflict, the last option wins watch –r –l 2 …preferences turned on, then off by –l 2 watch –l 2 –r …intended behavior (level 2 with preferences)

DoX() Does the actual processing required to execute the command Most DoX() function signatures are different –Depends on the data required to execute the command DoWatch(gSKI::IAgent* pAgent, const WatchBitset& options, const WatchBitset& settings, const int wmeSetting, const int learnSetting)

Command Line Interface Test App Included with Soar 8.6 is a simple CLI module test application Easy to debug simple changes to the command line interface inside Visual Studio using this app

Nuggets Syntax consistency –Standard option parsing Simple maintenance –Parsing separated from processing –Well documented Flexible option ordering –Last option wins Same command interface for all clients Many syntax changes –Bad for existing users EvilBackDoor and old interface usage Some command output generated by kernel –via print callbacks Structured (XML) output incomplete Coals

Questions? Online resources: – –