wsh2 Syntax

wsh → wsh2

wshws2comment
$-{...}$-[...$]geschweifte Klammern nur noch für Variabeln
$.$abc$.abcprimary brauchen und erlauben keine $ mehr
$@abc()$@abccall syntax ohne Klammern
$@abc{arg}$@%[abc arg$]call syntax mit Argumenten
$@.<$dsn ::F$@<-=[$dsn ::F$]nach file Operator kommt primary, nicht expression (aber pipe redirect immer noch expr!)

Implementation Problems

  • pipe: syntax für input String, und Mischung String files (wsh und pipe!)
  • $@ exprBlock hat nachteile: $@abc funktioniert nicht mehr direkt, $@.$.abc o.ä. (siehe tst) ist kontraintuitiv - besser primary?
  • directives: alte Syntax mit benannten units wirklich überflüssig - mit $@proc erreich man selbes ... --- syntax geändert sodass zwischen $#@ und nl verarbeitet wird

idee: var = name | '{' exprS '}' und { } brauchen wir nur noch für das, block wird nur [] oder //

  • assignment geht ohne vorgängiges = (aber $= braucht es wegen primary ⇔ statment
  • überall wo var steht, hört es auch wieder auf!
  • alle $-{3*2} müssen auf $-[3*2$] geändert werden
  • alte call Syntax $@abc(), $@abc-{...} etc.. muss auf $@£[abc$] geändert werden

abstract syntax

kind = '.' | '-' | '=' | '@'| ':' | '#'
op = '.' | '-' | '<' | '@' | '^' | '!' | '?'
primary = sConst | var | (( '.' | '-' ) op* ) (sConst | var | block ) $/../ is a blockEnd, neither a primary nor an assignment
var = name | '{' expr '}'
expr = ((noDo+ | '$'primary) comment* )+
pipe = ('<' exprBlo)* (( '>' | '>>') exprBlo)? ( stmt | expr )+ ( '|' ( stmt | expr )+ )*
unit = pipe? (';' pipe?)*
block = ( '%' | '^' )? kind? ( '[' | '/' name '/' ) ( unit | primary expr ) ( ']' | '/' name '/' )
exprBlo = op* ( block | kind? expr )
ass = '='? (var '=')? exprBlo at least one '=', without var only if a named block, see assCon
stmt = '$$' exprBlo
| ass
| '@' (block | primary | spComment+ expr)
| 'ct' stmt
| 'proc' var? stmt
| ( 'do' | 'with' ) (ass | expr ) stmt
| ('for' | 'forWith' | 'withNew' ) var? stmt
| 'table' (var | '.' expr)? nl? ('<'? var '>'? )+
wsh = nl'$#version'version)? (nl unit)? ( nl'$#' ( kind (spComm* nl)? unit | hook nl unit | ('*' | 'out' | 'end') text ) )*
hook = name noNl*

concrete syntax

assCon: Concrete Assignment

The details of the syntax is different depending on the context (which '=' is mandatory, optional, forbidden)

assMMM'=' var '=' exprBlo | '=' nmBloin statement with $
assOMM'='? var '=' exprBlo | '=' nmBloin statement without $
assFMMvar '=' exprBlo | '=' nmBloin with
assFFFvar exprBlo | nmBloin proc

'$', nl, spaces, comments

 dolNlEscape ignoredexplanation
primary   no $, nl, spaces, comments except, of course within a started block
expr  com$ only to start a primary, spaces are part of noDo, comments are squashed to 1 or 0 spaces
var  exStr 
expP  com sp 
pipe< > >> | stmt com spcom and sp are handled by expr if neighbouring, nl separates stmts and/or expr see stmtExpr and dolStmt
unit; com spcom sp are handled by pipe if neighbouring
nmBloending /.../   
block]   
exprBlo  exStr 
ass  com sp nl 
stmtstmt com sp nl 
  • ignored: lexcicals ignored within term, but not before and after (there rule for parent element applies)
  • exStr: leading and trailing spaces and comments around expr are stripped
  • dolNlEscape which syntax terms must be prefixed by an escape character, so they are recognized
    • mandatory prefixed by '$' if kind is not £
    • either prefixed by '$' or nl (sp | com)*, otherwise
  • stmtExpr = (spCom* | expr) ( nl expr)* (nl spCom*)?
    • partial lines besides statements are ingored
  • dolStmt
    • '$$' does neither need nor allow a third $
    • both forms of the assignment statement must be prefixed by '$=', but not by '$=='
    • all other statements must be prefixed by a single '$'. For historical reason a prefix of '$@' (but not '$@@') is allowed

lexicals

  • com = '**' noNL* | '*+' noNL* nl | '$*(' text '$*)'
  • name = alfaChar (alfaNumChar | '_', '@')*
    • wsh variable pool is casesensitive, but not rexx names!
    • statement names for, with etc. are not a name, however ${for} is a primary
  • sp = a single space character
  • nl = new line (pseudo character in z/os for next line)
  • noNl = any singel character except nl
  • noDo = any single character neither $ nor nl
  • text = any text possibly including '$' or nl until to the context dependent stopper, which must be prefixed by '$')
  • sConst = string constant: single or double quoted String with any nl's: 'abc', "e", 'I''m' etc.

variable name operators:

  • . inline dot (wie in rexx)
  • > access to m., plus field access if binary
  • & access to varPool, plus field access if binary
  • final op (if ends in text) if no ops at all then →& else →*
  • if no & or *, then first . → &, remaining . → *

rausgeschmissenes

kind '%' | für expressions ohne noDo und die meisten $ überflüssig ⇒ brauchen wir das wirklich
expW = primary | (('run' | 'runobj' | 'runstr') sp* primary sp*) exprBlo?) | 'compile' sp* primary
expr = expR | expW
unitW = (spNlCom | expW | stmt)+