- with syntax (block analog io redirection, sodass leave und iterate noch funktionieren), nicht getypt, einfach if symbo() == 'VAR then re ...
- inlineData in wsh Syntax spiegeln mit benanntem Input
- singleton as special kind ! ==> gibt es schon in Objekt Syntax, oder allgemeinere MultiplicitySyntax?
- block mit zwei Types (resultatKind innerKind), 2 = im assignment durch resultKind ersetzen?
- assignment mit namedBlock ohne varName $=/ab/ ... $/ab/ oder $=<./ab/, vielleicht Namenssysntax vereinfachen?
- ref =:[...] modifiziert bestehende Referenz, new falls null
- ref =<:[...] als Code. file führt Code beim Oeffnen aus
- stem =<:[...] ersetzt stemInhalt, new macht automatisch die Stem Typen
- stem =!
- oder besser:
- @ block --> runner
- < block --> jBuf mit Inhalt (via ioRedirection)
- - block --> concat
- other block: unwrap single (or no) object
- stem = <:[...
anforderungen general input / return reader oder writeAll in pipe
- eingentlich wäre Idee über stdIn stdOut (mit pipe) aber wie macht man das aus rexx?
- call pipeBeLa '<' file(); code ; call pipeEnd dreiZeilen?!
- call pipe1 '<' file(), 'code' quotingInterpret?!
- call sql pipeInOnce(s2o(...)) -- sql müsse inOnce einmal abholen und poppen
- pipeSemicolon
- pipeStrCall 'select .......', sql
- alternative mit einem Parameter
- direct als string: sql s2o('select ...)
- aus file: sql file('a.b.c')
- std input: sql jIn()
anforderungen directives / starter
- interpreter aufrufen, d.h. source als input nehmen, z.B. call sql $#<
- variabeln setzen für jcl
- kind setzen für input
- output setzen in editMacro
- verarbeitung für Input bestimmen in editMacro
wshCall = ( '$#' directive | wsh )* directive = ( 'omit' | 'end' | 'out' | ( kind | ... )
toDo
- remove compExpr 'd' ( => '')
- syntax directives
- replace allInFrame with a special toClose (function or keyword)
- use nested memory for frames or and copy it only at pop for allInFrame or reuse frame memory
- use nested memory for output buf and cat
- * for stdIn stdOut
stdIn the standard input for any function - thus it does not need a parameter for its input. The frequent input situations can be handled in wsh and rexx as follows:
- input one or several string (or obj?), evaluated in advance
- $; $$ ... $| .... $;
- $; $=[ $] $| .... $;
- call pipeBeLa '- eins', 'zwei' ...; ...; call pipeEnd
- input a file from fileSystem
- $; $<abc/efg .... $;
- call pipeBeLa '< abc/de'; ....; call pipeEnd
- input a file variable
- $; $<.$abc .... $;
- input a rexxObj obj (subclass of JRW)
- $; $<.obj .... $;
- input a code block evaluated at open/read time
- $; $<.=[ .... $] .... $;
- output to filesystem
- output to a buf in variable pool (with creation if not present) is now in the file: constructor - that is not a good place!
- output to a rexx variable or stdOut
- output to a code block
- pipeBegin: <, push
- pipe: pop buf/buf push
- pipeLast: pop buf/> push
- pipeBeLa < > push
- pipeEnd: pop
- possible enhancements
- opt <-: rest of this and all remaining args strings written to a new inputBuffer (pipeBeLa '<- eins', 'zwei'; ... (if first line == '<-' then empty buffer, '<- ' then buffer with empty string)
- pipeEndBe und pipeEndBeLa
- pipeAddIO mit 2. Argument (caller name) -> fehler falls falscher IO
stdSyn we need a syntax for stdIn and stdOut, e.g. when concatenating the input of stdIn instead of an other file
- if not an object assume it's a string
- use a common or registered prefix for objects
casting and operators
Status quo
- 2String: obj => String
- var: envGet
- Run: jCatLines(Run, ' ')
- 2obj: obj => obj
- var: envGetO
- string: s2o
- code: oRunner
- @ (run)
- obj: oRun
- file: pipeWriteAll
- 2file
- string: fileNamed
- obj: o2File
- Run: jBufRun
- String: fileNamed
extended kinds
- b a block with elements (expressions), b1, b2, ...
- ; c: rexx code, pseudoKind ;
- . j: object of class JRW
- . r: object of class ORun, includes . j
- . o: object of any class includes . r and . j
- - s: String
- a: anything
co: conditions
- aE: if each element of a block is . or -. The optimization with this condititon is semantically equivalent to the following definition without the exception, if none of the expression has side effects
op | from | co | to | result | rexx |
---|---|---|---|---|---|
- | b | aE | - | cocatenates each line (- bi) casted to string, separated by 1 space | |
- | b | - | -; b | ||
- | ; c | - | executes c and concatenates (- oi) for each output oi separated by one space | ||
- | . r | - | -@r | o2string(f) | |
- | - s | - | identy | s | |
- | . o | - | depending of class of o select correct cast from above | o2String(o) | |
. | b | . | !; b | ||
. | - s | . | cast string to strW | s2o(s) | |
. | ; c | . r | yields an ORun with code c as oRun method | oRunner(c) | |
. | . o | . | identity | o | |
< | b | . j | <@b | ||
< | ; c | . j | yields jBuf with output of execution of c | o2file(oRunner(c))) | |
< | - s | . j | file with fileSpec s | file(s) | |
< | . j | . j | identiy | j | |
< | . o | . j | if String or JRW as above, otherwise <@o | o2file(o) | |
! | b | aE | . | yields (. b1) if b has exactly on element otherwise fails | |
! | b | . | !; b | ||
! | ; c | . | executes c and yields ( o1) for the only output o1, fails if not exactly one output | ??? | |
! | a | . | !@ a | ||
? | b | aE | . | yields null if b is empty, (. b1) if b has exactly 1 element, otherwise fails | |
? | a | . | analogous to ! | ||
; | ; b | ; | execute each (; bi) element of the block casted to ; | ||
; | - s | ; | write s to stdOut | call out s | |
; | . o | ; | write o to stdOut | call outO o | |
; | ; c | ; | execute c | ||
@ | b | ; | ; b | ||
@ | . j | ; | reads j writes each line read (casted to obj) to stdOut | call jWriteAll j | |
@ | . o | ; | runs o | oRun(o) | |
@ | ; c | ; | executes c |
vorher
from | to | op | rexx | |
---|---|---|---|---|
String | String | - | identity | |
File | String | - | o2String | reads file and concatenates the lines (separated by one space). Fails if a line is not a String |
ORun | String | - | o2String | Runs the Run and concatenates ouput as for File |
Object | String | - | o2String | ObjString yields value. Other classes as defined above, otherwise method o2String or fails |
String | File | < | file | String is filename (or specification) as implemented in the class File for Operating System used |
File | File | < | = | identity |
Run | File | < | o2File | File runs Run at open time, subsequent reads will read the output (can append further line inbetween) |
Object | File | < | o2File | as defined for different classes above |
String | ORun | @ | fails | |
File | ORun | @ | by inheritance: File writes its content to stdOutput | |
ORun | ORun | @ | identity | |
Object | ORun | @ | oRun | Uses oRun method of object, fails if not existing |
String | Object | . | s2o | new ObjClass with value of the String |
File | Object | . | = | by inheritance |
ORun | Object | . | = | by inheritance |
Object | Object | . | = | identity |
name | symbol | Linux | wsh | rexx |
---|---|---|---|---|
escape to wsh | $ | Escape to wsh, variableMarker $var, output $$ | ||
comment | * | $**, $*+ or $*(....$*) | ||
piping | ||||
pipe | ! | | | stmt1 $| stmt2 | ... call pipe ... |
redirectOutput | > | output redirection $>... | call pipeLast '> fileName' | |
redirectInput | < | input redirection $<... | call pipeBegin '< fileName' | |
semicolon | ; | Statement separator in $; | call pipeBegin ... call pipeEnd | |
expressions | ||||
value | - | expression in $(, $-[, $-{, $-comp..., | o2string | |
obj | . | expression in $(, $-[, $-{, $-comp..., | s2o, file, etc. | |
isDefined | ? | in ${?a}: is variable defined? | envHasKey | |
StringDelimiter | " | $"..." | ||
StringDelimiter | ' | $'...' | ||
statements | ||||
assignment | = | $=var= ... | envPut, envPutO | |
run | @ | run block, call procedure, run object, $@for etc. | call ... | |
blocks | ||||
braceBlock | {...} | for variables ${a} or short blocks $-{1+1} | ||
bracketBlock | [...$] | |||
slashBlock | /name/ .... $/name/ | |||
fileSpecs | ||||
external spec | & | |||
user | ~ | ~.work.~ | dsn2jcl | |
var | # | #var |
the class hierarchy classes
obj a reference to an object, this is of course also a rexx String, but its contents is interpreted as objectAdress for an object with a class, not as contents
StrW an object, that is a string constant, the current implementation is a prefix by m.class.escW = ']'. In the rexx the class is called m.class.classW = 'w'.
StrV an object, that is a string variable that is directly assigned to m.a if the address is a. In the rexx the class is called m.class.classV = 'v'.
ORun an object that contains a method, that executes (interprets) some rexx code in its method oRun
JRW a class supporting Reads and Writes. the basis for all types of files and pipes. The oRun method reads until endOfFile and writes each object read unchanged to stdOut. If the JRW is not opened yet, it is opened for read and closed afterwards.
systematic operations
- cat(mid, file): file => string
- cats all lines, with mid between each two lines, fails if it reads something not a string (or o2string?)
- singelton: file => obj
- returns first object of file, fails if file contains no or 2 or more objects
- commandSubstitution: block => file (output or contents of block)
- is this necessary
- run: stmt => file
- runs the stmt and ouput goes to stdOut (necessary?)
- fileNamed: string => file
- returns a file accessing the file with that name in the filesystem: fileSpec features ~. stdIn, stdOut, buf in variablePool? creates file if missing, ....,
- fileOf: obj* => file
- a file with contents of the given objects
- o2file: obj => file
- for run:
- open input: run run and its stdOut is returned by read
- open output: stores all output, at close time run is run with input the stored output
- string fileNamed ???
- for run:
strNat detect strings without leading strEsc
- if not an object assume it's a string
- use a common or registered prefix for objects
Plans, toDo
- simple include facility and general compileTime processing and generating permanent named classes
- Env or EnvMan without typing?
- Batch interface with statments (assignments) in inputstring
- Wir arbeiten immer mit obj → value mit spezieller Syntax
- lokal Variablen, v.a. als Argumente für geschachtelte Blöcke, diese sind deklariert und durch ein statistche localMap auf eine localStack gemappt $@{:eins :zwei call....
- data Syntax $...[...] und constHereData $/abc/ .......$/abc/
- Prozedur aufruf [$@name $@name](primWord, primWord, ....) oder $-name(... (um objReferenz zurückzubekommen) name muss eine (evt. Lokel) Variable sein, kindOf Run
- noOpenClose automatisch, falls schon offen oder besser explizit
- compile time
- fileMarker < statt |
- assignment und output statements gehen bis endOfLine nicht nur shWord wie sonst – sinnvoll oder nicht?
- Statt CodeBlöcke immer Singletons von Run zu machen, ist das schlau?
- BufVar # eliminieren $>#eins können wir durch $>$eins oder $=eins.@{..$} ersetzen
- Problem: $var in language bringt jetzt immer String zurück – aber $.$xx sollte obj bringen (Verschachtelungen??? - besser $-$xx zwingt auch Value!