wsh3 Syntax

wsh2 → wsh3

wsh2wsh3comment
$>.fEdit()$>. fEdit()nach . kommt in wsh3 primary, damit es expression gibt, braucht es Space

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!)

todo

  • complexe DatenStruktur wie in tut05
  • tutorial nach syntax - als tutorial und als test

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 3

kind = '.' | '-' | '=' | '@'| ':' | '#' | '^' | '%'
op = '.' | '-' | '<' | '@' | '!' | '?' | '^' | '%'
primary = sConst | var | block
var = name | '{' expr '}'
expr = textLi | var oPrBlEx? | (noDo+ | '$' sConst | '$' var | '$' ( '.' | '-' ) op* primary )+
  • kind # only text
  • kind ^ or % is a call: var is the run to call, oPrBlEx the facultativ arguments
  • the third variant for the other kinds
  • $/../ is a blockEnd, neither a primary nor an assignment, $[ is illegal
oPrBlEx = op* ('#' | '=' | '<') expr | primary | kind? spCom+ expr )
pipe = ('<' oPrBlEx)* (( '>' | '>>') oPrBlEx)? ( stmt | expr )+ ( '|' ( stmt | expr )+ )*
  • default kind for oPrBlEx is =, default kind for expr given by context, for kind # everything is text
unit = pipe? ('<>' pipe?)*
nmBlock = kind? '/' name '/' unit '/' name '/'
block = kind? '[' unit ']' | nmBlock
ass = '='? (var '=')? oPrBlEx
  • default kind for oPrBlEx is =, at least one '=', without var only if a named block, see assCon
stmt = '$$' oPrBlEx
| ass
| '@' oPrBlEx
| '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 (spCom* nl)? unit | hook nl unit | ('*' | 'out' | 'end') textLi+ ) )*
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 | '$*(' clText '$*)'
  • 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
  • textLi = any text possibly including '$' until nl (end of line) , or the context dependent stopper, which must be prefixed by '$' and start at the beginning of the line)
  • 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 . → *