This document is a sample of how Dick Botting's  MATHS notation can be used to write documentation.

EMail comments to: <dick@csci.csusb.edu>

The objectives of this notation aredefined in the MATHS manifesto.

Also see the introductions, the overview, the description of the notations(like '::=', '#(_)', 'O(_)', '|', '&', etc), more samples, and a draft formal definition.

See my home page for information on other formal notations and methods.

Contents


/u/faculty/dick/cs320/math.comp.ascii
|- white_space::= SP | HT | ...
doublequote::=
"\"", quote:="'", backquote::="`", backslash::="\\".

SYNTAX

The Bourne shell a pure interpreter for a highly interactive, complex and powerful programming language with syntax based loosely on ALGOL 68. The basic input (from a user or from a file) into the interpreter (sh) is a sequence of pipelined commands.

pipeline::=
command (input_redirection|) #("|" command) ("|" command output_redirction|).

input_redirection::=
"<" file | "<<"string.
output_redirection::=
( ">" | ">>" ) file.

command::=
command_name #(separator argument), Normally, separator::=whitespace #whitespace.

argument::=
#(word | string | escaped_symbol ),
word::=
#(value_shell_variable| value_of_argument | #(char~separator)),

A script is a sequence of commands and control structures separated by command separators

script::=
(command | built_in_structure) #(command_separator (command | built_in_structure)),
command_separator::=
EOLN #whitespace | semicolon #whitspace.

built_in_structure::=
assignment | selection | loop | other_command,
selection::=
if_then_fi | case_esac,
loop::=
for_do_done | while_do_done | ... .
other_command::=
exit_statement | echo_statement |... .

A shell variable is identified by an identifier:
shell_variable::=
identifier,
value_of_variable::=
"$" variable| "${" identifier operator word "}", The "${...}" form is left undefined.

Arguments are numbered inside a shell script:
script_argument::=
digit,
value_of_argument::=
"$"digit.

There are several special variables/values:
value::=
value_of_argument | value_of_variable | "$" ( "$" | "?" | "#" | "!" |
..).

string::=
double_quoted_string |single_quoted_string|reverse_quoted_string,

escaped_symbol::=
backslash char,

double_quoted_string::=
double_quote #( value_of_variable | value_of_argument | #(char~double_quote) | escaped_symbol) double_quote,
reverse_quoted_string::=
backquote pipeline backquote,
single_quoted_string::=
quote #(char~quote | escaped_symbol) quote.


Sections and Definitions in Alphabetical Order


dick@csci.csusb.edu.
Home Page
Disclaimer: CSUSB may or may not agree with this message.
Copyright(1994): Copy and use as you wish as long as you include this copyright and signature.